Exemplo n.º 1
0
/**
 * dynamically generate the page
 *
 * @see skins/index.php
 */
function send_body()
{
    global $context;
    // only associates can proceed
    if (!Surfer::is_associate()) {
        Safe::header('Status: 401 Unauthorized', TRUE, 401);
        echo '<p>' . i18n::s('You are not allowed to perform this operation.') . "</p>\n";
        // forward to the index page
        $menu = array('scripts/' => i18n::s('Server software'));
        echo Skin::build_list($menu, 'menu_bar');
        // ask for confirmation
    } elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'GET') {
        // the splash message
        echo '<p>' . i18n::s('This tool will include most of the running reference PHP scripts. Any syntax error should be spotted easily.') . '</p>';
        // the submit button
        echo '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . Skin::build_submit_button(i18n::s('Yes, I want to validate scripts'), NULL, NULL, 'confirmed') . '</p></form>';
        // set the focus on the button
        Page::insert_script('$("#confirmed").focus();');
        // this may take some time
        echo '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
        // just do it
    } else {
        // the splash message
        echo '<p>' . i18n::s('All reference scripts are included, to show evidence of possible syntax errors.') . "</p>\n";
        // list running scripts
        echo '<p>' . i18n::s('Listing files...') . BR . "\n";
        // locate script files starting at root
        $scripts = Scripts::list_scripts_at(NULL);
        if (is_array($scripts) && count($scripts)) {
            echo BR . sprintf(i18n::s('%d scripts have been found.'), count($scripts)) . "\n";
            natsort($scripts);
        }
        echo "</p>\n";
        // including scripts
        echo '<p>' . i18n::s('Including reference scripts...') . BR . "\n";
        // strip as much output as possible
        $_SERVER['REQUEST_METHOD'] = 'HEAD';
        // we will finalize this page later on
        global $finalizing_fuse;
        $finalizing_fuse = FALSE;
        // take care of dependancies
        include_once '../behaviors/behavior.php';
        include_once '../services/codec.php';
        include_once '../users/authenticator.php';
        // analyse each script
        $included_files = 0;
        $links_to_be_checked_manually = array();
        foreach ($scripts as $file) {
            // ensure we have enough time to process this script
            Safe::set_time_limit(30);
            // skip run once scripts
            if (strpos($file, 'run_once/')) {
                continue;
            }
            // don't include ourself
            if ($file == 'scripts/validate.php') {
                continue;
            }
            // process only reference scripts
            if (!Scripts::hash($file)) {
                continue;
            }
            // check file content
            if (!($handle = Safe::fopen($file, 'rb'))) {
                echo sprintf(i18n::s('%s has no readable content.'), $file) . BR . "\n";
                continue;
            }
            // look at the beginning of the file
            if (!($header = fread($handle, 16384))) {
                echo sprintf(i18n::s('%s has no readable content.'), $file) . BR . "\n";
                fclose($handle);
                continue;
            }
            fclose($handle);
            // skip scripts that generate content asynchronously
            if (stripos($header, 'send_body') || stripos($header, 'page::content')) {
                $links_to_be_checked_manually[$file] = '(asynchronous)';
                continue;
            }
            // skip scripts that would redefine our skin
            if (stripos($header, 'extends skin_skeleton')) {
                $links_to_be_checked_manually[$file] = '(skin)';
                continue;
            }
            // log script inclusion on development host
            if ($context['with_debug'] == 'Y') {
                logger::remember('scripts/validate.php: inclusion of ' . $file, '', 'debug');
            }
            // include the script and display any error
            $included_files += 1;
            $validate_stamp = time();
            echo sprintf(i18n::s('inclusion of %s'), $file) . "\n";
            Safe::chdir($context['path_to_root'] . dirname($file));
            include_once $context['path_to_root'] . $file;
            $duration = time() - $validate_stamp;
            if ($duration) {
                echo ' (' . $duration . 's.)';
            }
            echo BR;
        }
        // memory status
        $used_memory = '';
        if (is_callable('memory_get_usage')) {
            $used_memory = ' (' . memory_get_usage() . ' bytes)';
        }
        // report of included files
        if ($included_files > 1) {
            echo '<p>' . sprintf(i18n::s('%d files have been included.'), $included_files) . $used_memory . '</p>';
        }
        // list files to be checked manually
        if (count($links_to_be_checked_manually)) {
            echo '<p>' . i18n::s('Following scripts have to be included separately:') . BR . "\n";
            ksort($links_to_be_checked_manually);
            foreach ($links_to_be_checked_manually as $file => $label) {
                echo Skin::build_link($file, $file, 'basic') . ' ' . $label . BR . "\n";
            }
            echo sprintf(i18n::s('%d files to be checked manually.'), count($links_to_be_checked_manually)) . '</p>' . "\n";
        }
        // display the execution time
        $time = round(get_micro_time() - $context['start_time'], 2);
        echo '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
        // forward to the referential building
        echo '<form method="get" action="' . $context['url_to_root'] . 'scripts/build.php"><p>' . "\n" . Skin::build_submit_button(i18n::s('If no error has popped up, build the reference set >>')) . "\n" . '</p></form>' . "\n";
        // this may take some time
        echo '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
        // clear text some scripts could have added
        $context['debug'] = '';
        $context['extra'] = '';
        $context['navigation'] = '';
        $context['suffix'] = '';
        $context['text'] = '';
        $context['page_details'] = '';
        $context['page_footer'] = '';
        $context['page_menu'] = array();
        $context['page_tags'] = '';
        $context['page_tools'] = '';
        // now we will finalize this page
        global $finalizing_fuse;
        unset($finalizing_fuse);
    }
}
Exemplo n.º 2
0
Arquivo: new.php Projeto: rair/yacs
        $context['text'] .= sprintf(i18n::s('%d transmission errors have been encountered.'), $recipients_errors) . BR . "\n";
    }
    // save digest stamp, if any
    if (isset($_REQUEST['digest_stamp']) && $_REQUEST['digest_stamp'] > NULL_DATE) {
        Values::set('letters.digest.stamp', $_REQUEST['digest_stamp']);
    }
    // display the execution time
    $time = round(get_micro_time() - $context['start_time'], 2);
    $context['text'] .= '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
    // forward to the index page
    $menu = array('letters/' => i18n::s('Newsletters'));
    $context['text'] .= Skin::build_list($menu, 'menu_bar');
    // make the user select an option
} else {
    // the splash message
    $context['text'] .= '<p>' . i18n::s('This script will help you to prepare and to send a electronic message to community members. Please select below the action you would like to perform. Depending on your choice, the assistant may ask for additional parameters on successive panels.') . '</p>' . "\n";
    // the form
    $context['text'] .= '<form method="get" action="' . $context['script_url'] . '" id="main_form">' . "\n";
    // a digest of most recent articles
    $context['text'] .= '<p><input type="radio" name="action" value="digest" selected="selected" /> ' . i18n::s('Send a digest of articles published recently') . '</p>' . "\n";
    // list featured pages
    $context['text'] .= '<p><input type="radio" name="action" value="featured" /> ' . i18n::s('List featured pages') . '</p>' . "\n";
    // some announcement
    $context['text'] .= '<p><input type="radio" name="action" value="announcement" /> ' . i18n::s('Send one announcement to community members') . '</p>' . "\n";
    // the submit button
    $context['text'] .= '<p>' . Skin::build_submit_button(i18n::s('Next step'), i18n::s('Press [s] to continue'), 's') . '</p>' . "\n";
    // end of the form
    $context['text'] .= '</form>' . "\n";
}
// render the skin
render_skin();
Exemplo n.º 3
0
Arquivo: switch.php Projeto: rair/yacs
} else {
    // if the server is currently switched off
    if (file_exists($context['path_to_root'] . 'parameters/switch.off')) {
        // server status
        Logger::error(i18n::s('The server is currently switched off. All users are redirected to the closed page.'));
        // the confirmation question
        $context['text'] .= '<b>' . i18n::s('You are about to open the server again. Are you sure?') . "</b>\n";
        // the menu for this page
        $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><p>' . Skin::build_submit_button(i18n::s('Yes, I do want to switch this server on')) . '<input type="hidden" name="action" value="on" />' . '</p></form>' . "\n";
        // else the server is currently switched on
    } else {
        // server status
        $context['text'] .= '<p>' . i18n::s('The server is currently switched on. Pages are provided normally to surfers.') . "</p>\n";
        // the confirmation question
        $context['text'] .= '<p><b>' . i18n::s('You are about to close the server. Are you sure?') . "</b></p>\n";
        // the menu for this page
        $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><div>' . Skin::build_submit_button(i18n::s('Yes, I do want to switch this server off')) . '<input type="hidden" name="action" value="off" />';
        // redirect
        $label = i18n::s('Option: redirect requests to the following address');
        $input = '<input type="text" name="switch_target" size="45" maxlength="255" />';
        $context['text'] .= '<p>' . $label . BR . $input . "</p>\n";
        // contact information
        $label = i18n::s('Option: contact information, such as an email address');
        $input = '<input type="text" name="switch_contact" size="45" maxlength="255" />';
        $context['text'] .= '<p>' . $label . BR . $input . "</p>\n";
        // end of the form
        $context['text'] .= '</div></form>' . "\n";
    }
}
// render the skin
render_skin();
Exemplo n.º 4
0
Arquivo: check.php Projeto: rair/yacs
                }
            } else {
                $errors_count = 0;
            }
        }
    }
    // ending message
    $context['text'] .= sprintf(i18n::s('%d records have been processed'), $count) . BR . "\n";
    // display the execution time
    $time = round(get_micro_time() - $context['start_time'], 2);
    $context['text'] .= '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
    // forward to the index page
    $menu = array('comments/' => i18n::s('Threads'));
    $context['text'] .= Skin::build_list($menu, 'menu_bar');
    // which check?
} else {
    // the splash message
    $context['text'] .= '<p>' . i18n::s('Please select the action to perform.') . "</p>\n";
    // the form
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form">';
    // look for orphan articles
    $context['text'] .= '<p><input type="radio" name="action" id="action" value="orphans" /> ' . i18n::s('Look for orphan records') . '</p>';
    // the submit button
    $context['text'] .= '<p>' . Skin::build_submit_button(i18n::s('Start')) . '</p>' . "\n";
    // end of the form
    $context['text'] .= '</form>';
    // set the focus on the button
    Page::insert_script('$("#action").focus();');
}
// render the skin
render_skin();
Exemplo n.º 5
0
if (isset($item['avatar_url']) && $item['avatar_url']) {
    $context['text'] .= '<p>' . sprintf(i18n::s('Current picture: %s'), BR . '<img src="' . $item['avatar_url'] . '" alt="" style="avatar" />') . '</p>' . "\n";
} else {
    $context['text'] .= '<p>' . i18n::s('No picture has been set for this profile.') . '</p>';
}
// list available avatars, except on error
if (!count($context['error']) && isset($item['id'])) {
    // upload an image
    //
    if (Images::allow_creation($item, null, 'user')) {
        // the form to post an image
        $text = '<form method="post" action="' . $context['url_to_root'] . 'images/edit.php" id="main_form" enctype="multipart/form-data"><div>' . '<input type="hidden" name="anchor" value="user:'******'id'] . '" />' . '<input type="hidden" name="action" value="set_as_avatar" />';
        $fields = array();
        // the image
        $text .= '<input type="file" name="upload" id="upload" size="30" accesskey="i" title="' . encode_field(i18n::s('Press to select a local file')) . '" />';
        $text .= ' ' . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
        $text .= BR . '<span class="details">' . i18n::s('Select a .png, .gif or .jpeg image.') . ' (&lt;&nbsp;' . Skin::build_number($image_maximum_size, i18n::s('bytes')) . ')</span>';
        // end of the form
        $text .= '</div></form>';
        // the script used for form handling at the browser
        Page::insert_script('$("#upload").focus();');
        $context['text'] .= Skin::build_content(NULL, i18n::s('Upload an image'), $text);
    }
    // use the library
    //
    // where images are
    $path = 'skins/_reference/avatars';
    // browse the path to list directories and files
    if ($dir = Safe::opendir($context['path_to_root'] . $path)) {
        $text = '';
        if (Surfer::may_upload()) {
Exemplo n.º 6
0
load_skin('services');
// the title of the page
$context['page_title'] = i18n::s('Sample blog client');
// make a target
$target = '';
if (isset($_REQUEST['target'])) {
    $target = $_REQUEST['target'];
} elseif (isset($context['host_name'])) {
    $target = $context['host_name'] . rtrim($context['url_to_root'], '/');
}
$user_name = isset($_REQUEST['user_name']) ? $_REQUEST['user_name'] : '';
$user_password = isset($_REQUEST['user_password']) ? $_REQUEST['user_password'] : '';
// display a specific form
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>';
$label = i18n::s('Server address');
$input = '<input type="text" name="target" id="target" size="30" maxlength="128" value="' . encode_field($target) . '" />' . "\n" . ' ' . Skin::build_submit_button(i18n::s('Go'));
$hint = i18n::s('The name or the IP address of the yacs server');
$fields[] = array($label, $input, $hint);
$label = i18n::s('User name');
$input = '<input type="text" name="user_name" size="30" maxlength="128" value="' . encode_field($user_name) . '" />';
$fields[] = array($label, $input);
$label = i18n::s('User password');
$input = '<input type="password" name="user_password" size="30" maxlength="128" value="' . $user_password . '" />';
$fields[] = array($label, $input);
$context['text'] .= Skin::build_form($fields);
$context['text'] .= '</div></form>';
// set the focus at the first field
Page::insert_script('$("#target").focus();');
// do the test
if (isset($_REQUEST['target'])) {
    // call blog web service
Exemplo n.º 7
0
Arquivo: ping.php Projeto: rair/yacs
            list($server_ping, $server_label) = $attributes;
            $milestone = get_micro_time();
            $result = @Call::invoke($server_ping, 'weblogUpdates.ping', array(strip_tags($context['site_name']), $context['url_to_home'] . $context['url_to_root']), 'XML-RPC');
            if ($result[0]) {
                $label = round(get_micro_time() - $milestone, 2) . ' sec.';
            } else {
                $label = @$result[1];
            }
            $context['text'] .= '<li>' . $server_label . ' (' . $label . ')</li>';
        }
        $context['text'] .= '</ul>';
        // no server to ping
    } else {
        $context['text'] .= '<p>' . i18n::s('No server has been created yet.') . '</p>';
    }
    // back to the index of servers
    $menu = array('servers/' => i18n::s('Servers'));
    $context['text'] .= Skin::build_list($menu, 'menu_bar');
    // remember this in log as well
    Logger::remember('servers/ping.php: The cloud has been pinged');
    // operation has to be confirmed
} else {
    // introductory text
    $context['text'] .= '<p>' . i18n::s('This script will ping (<code>weblogUpdates.ping</code>) every server configured to be part of our cloud. Normally, the publication script does this automatically. However, no ping occurs for pages submitted by XML-RPC or by e-mail. Therefore, you should launch this script at least once per month to ensure everybody knows about this site.') . '</p>';
    // the submit button
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . '<input type="hidden" name="action" value="ping" />' . Skin::build_submit_button(i18n::s('Yes, I want to ping the cloud')) . '</p></form>';
    // set the focus on the backup button
    Page::insert_script('$("#go").focus();');
}
// render the skin
render_skin();
Exemplo n.º 8
0
Arquivo: edit.php Projeto: rair/yacs
            if ($file == $item) {
                $checked = ' selected="selected"';
            }
            $items[] = '<option value="' . $item . '"' . $checked . '>skin/' . $skin . '/' . $item . "</option>\n";
        }
        Safe::closedir($dir);
        // list items by alphabetical order
        if (@count($items)) {
            natsort($items);
            foreach ($items as $item) {
                $context['text'] .= $item;
            }
        }
    }
    $context['text'] .= '</select> ' . Skin::build_submit_button(i18n::s('Go')) . '</p></form>';
    // allow for content modification
    if ($file) {
        // start of the form
        $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><div>' . '<input type="hidden" name="skin" value="' . encode_field($skin) . '" />' . '<input type="hidden" name="file" value="' . encode_field($file) . '" />';
        // load file content
        if (!($content = Safe::file_get_contents('../skins/' . $skin . '/' . $file))) {
            Logger::error(i18n::s('No file has been transmitted.'));
        }
        // textarea to edit the file
        $context['text'] .= '<textarea name="content" rows="25" cols="50" accesskey="c">' . encode_field($content) . '</textarea>';
        // button to upload changes
        $context['text'] .= BR . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's') . '</div></form>' . "\n";
    }
}
// render the skin
render_skin();
Exemplo n.º 9
0
Arquivo: leave.php Projeto: rair/yacs
    } else {
        $context['text'] .= '<p>' . sprintf(i18n::s('You have been assigned as an editor of %s, and this allows you to contribute to this page, and to be notified of changes.'), Skin::build_link($anchor->get_url(), $anchor->get_title())) . '</p>';
    }
    // cautioon on private areas
    if ($anchor->get_active() == 'N') {
        if ($type == 'section') {
            $context['text'] .= '<p>' . i18n::s('Access to this section is restricted. If you continue, it will become invisible to you, and you will not be able to even browse its content anymore.') . '</p>';
        } else {
            $context['text'] .= '<p>' . i18n::s('Access to this page is restricted. If you continue, it will become invisible to you, and you will not be able to even browse its content anymore.') . '</p>';
        }
    }
    // ask for confirmation
    if ($type == 'section') {
        $context['text'] .= '<p>' . i18n::s('You are about to suppress all your editing rights on this section.') . '</p>';
    } else {
        $context['text'] .= '<p>' . i18n::s('You are about to suppress all your editing rights on this page.') . '</p>';
    }
    $bottom = '<p>' . i18n::s('Are you sure?') . '</p>';
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Yes'), NULL, NULL, 'confirmed');
    $menu[] = Skin::build_link($anchor->get_url(), i18n::s('No'), 'span');
    // render commands
    $bottom .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $anchor->get_reference() . '" />' . "\n" . '<input type="hidden" name="action" value="leave" />' . "\n" . '</p></form>' . "\n";
    //
    $context['text'] .= Skin::build_block($bottom, 'bottom');
    // set the focus
    Page::insert_script('$("confirmed").focus();');
}
// render the skin
render_skin();
Exemplo n.º 10
0
Arquivo: delete.php Projeto: rair/yacs
        }
    }
    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
} else {
    // commands
    $menu = array();
    $delete_label = '';
    if (is_object($overlay)) {
        $delete_label = $overlay->get_label('delete_confirmation', 'comments');
    }
    if (!$delete_label) {
        $delete_label = i18n::s('Yes, I want to delete this comment');
    }
    $menu[] = Skin::build_submit_button($delete_label, NULL, NULL, 'confirmed', $render_overlaid ? 'button submit-overlaid' : 'button');
    if (isset($item['id']) && !$render_overlaid) {
        $menu[] = Skin::build_link(Comments::get_url($item['id']), i18n::s('Cancel'), 'span');
    } elseif ($render_overlaid) {
        $menu[] = '<a href="javascript:;" onclick="Yacs.closeModalBox()">' . i18n::s('Cancel') . '</a>' . "\n";
    }
    // the submit button
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form">' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . (isset($_REQUEST['follow_up']) ? '<input type="hidden" name="follow_up" value="' . $_REQUEST['follow_up'] . '" />' . "\n" : '') . '</form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    // display the full comment
    $context['text'] .= '<div style="padding: 1em; background-color:#CCC;">' . Codes::beautify($item['description']) . '</div>' . "\n";
    // details
    $details = array();
    // the poster of this comment
    $details[] = sprintf(i18n::s('by %s %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Skin::build_date($item['create_date']));
Exemplo n.º 11
0
        $fields[] = array($label, $input);
        // the password has to be repeated for confirmation
        $label = i18n::s('Password confirmation');
        $input = '<input type="password" name="confirm" size="20" value="' . encode_field(isset($_REQUEST['confirm']) ? $_REQUEST['confirm'] : '') . '" />';
        $fields[] = array($label, $input);
        // append the script used for data checking on the browser
        Page::insert_script('$("#password").focus();');
    }
    // stop replay attacks and robots
    if ($field = Surfer::get_robot_stopper()) {
        $fields[] = $field;
    }
    // build the form
    $context['text'] .= Skin::build_form($fields);
    // cancel link
    if (!isset($item['id'])) {
        $cancel_url = $context['url_to_home'] . $context['url_to_root'];
    } else {
        $cancel_url = Users::get_permalink($item);
    }
    // bottom commands
    $context['text'] .= Skin::finalize_list(array(Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's'), Skin::build_link($cancel_url, i18n::s('Cancel'), 'span')), 'assistant_bar');
    // hidden field that have to be saved as well
    if (isset($item['id']) && $item['id']) {
        $context['text'] .= '<input type="hidden" name="id" value="' . $item['id'] . '" />';
    }
    // end of the form
    $context['text'] .= '</div></form>';
}
// render the skin
render_skin();
Exemplo n.º 12
0
Arquivo: ajax.php Projeto: rair/yacs
 * @author Bernard Paques
 * @reference
 * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
 */
// common definitions and initial processing
include_once '../shared/global.php';
// load localized strings
i18n::bind('tools');
// load the skin
load_skin('tools');
// the path to this page
$context['path_bar'] = array('tools/' => i18n::s('Tools'));
// page title
$context['page_title'] = i18n::s('AJAX demonstration');
// working overlay
$context['text'] .= '<p style="margin-bottom: 1em;">' . Skin::build_submit_button(i18n::s('Working overlay')) . ' - ' . i18n::s('Click on the button, then click on the overlay to hide it') . '</p>' . "\n";
// a modal box
$context['text'] .= '<p style="margin-bottom: 1em;"><a href="#" onclick="Yacs.displayModalBox({ title: &quot;' . i18n::s('AJAX demonstration') . '&quot;,' . 'body: &quot;Lorem ipsum dolor sit amet, consectetur adipisicing elit,<br />sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.&quot;,' . 'button_TRUE: &quot;' . i18n::s('OK') . '&quot;}, function(choice) { alert(\'' . i18n::s('OK') . '\') } ); return false;" class="button"><span>' . i18n::s('Modal box') . '</span></a> - ' . i18n::s('Click on the button, then handle the modal box') . '</p>' . "\n";
// an alert box
$context['text'] .= '<p style="margin-bottom: 1em;"><a href="#" onclick="Yacs.alert(\'' . i18n::s('AJAX demonstration') . '\', function() { alert(\'' . i18n::s('OK') . '\') })" class="button"><span>' . i18n::s('Alert box') . '</span></a> - ' . i18n::s('Click on the button to show the alert message') . '</p>' . "\n";
// a confirmation dialog box
$context['text'] .= '<p style="margin-bottom: 1em;"><a href="#" onclick="Yacs.confirm(\'' . i18n::s('AJAX demonstration') . '\', function(choice) { if(choice) { alert(\'' . i18n::s('OK') . '\') } })" class="button"><span>' . i18n::s('Confirmation box') . '</span></a> - ' . i18n::s('Click on the button to make your choice') . '</p>' . "\n";
// notifications
$context['text'] .= '<p style="margin-bottom: 1em;"><a href="#" onclick="Yacs.handleAlertNotification({ title: &quot;' . i18n::s('Alert notification') . '&quot;,' . 'nick_name: &quot;Foo Bar&quot;,' . 'address: &quot;http://www.google.com/&quot; })" class="button"><span>' . i18n::s('Alert notification') . '</span></a>' . ' <a href="#" onclick="Yacs.handleBrowseNotification({ message: &quot;' . i18n::s('Browse notification') . '&quot;,' . 'nick_name: &quot;Foo Bar&quot;,' . 'address: &quot;http://www.google.com/&quot; })" class="button"><span>' . i18n::s('Browse notification') . '</span></a>' . ' <a href="#" onclick="Yacs.handleHelloNotification({ message: &quot;' . i18n::s('Hello notification') . '&quot;,' . 'nick_name: &quot;Foo Bar&quot; })" class="button"><span>' . i18n::s('Hello notification') . '</span></a> - ' . i18n::s('Click on buttons to process notifications') . '</p>' . "\n";
// a scaled iframe for preview
$context['text'] .= '<p style="margin-bottom: 1em;"><a href="http://www.cisco.com/" class="button tipsy_preview"><span>' . i18n::s('Cisco') . '</span></a> - ' . i18n::s('Hover the button to display a preview') . '</p>' . "\n";
// a popup box
$context['text'] .= '<p style="margin-bottom: 1em;"><a href="http://www.cisco.com/" onclick="Yacs.popup( { url: this.href, width: \'100%\', height: \'100%\' } ); return false;" class="button"><span>' . i18n::s('Cisco') . '</span></a> - ' . i18n::s('Click on the button to trigger the popup window') . '</p>' . "\n";
// a JSON-RPC call -- see services/rpc_echo_hook.php
$context['text'] .= '<p style="margin-bottom: 1em;"><a href="#" onclick="Yacs.call( { method: \'echo\', params: { message: \'' . i18n::s('AJAX demonstration') . '\' }, id: 123 }, function(s) { if(s.message) { alert(s.message); } else { alert(\'failed!\'); } } ); return false;" class="button"><span>JSON-RPC echo</span></a> - ' . i18n::s('Click on the button to call a remote function') . '</p>' . "\n";
// another JSON-RPC call -- see services/rpc_activity_hook.php
Exemplo n.º 13
0
Arquivo: view.php Projeto: rair/yacs
        // owners of parent containers
        $reference = $item['anchor'];
        while ($reference) {
            if (!($parent = Anchors::get($reference))) {
                break;
            }
            if (($owner_id = $parent->get_value('owner_id')) && ($user = Users::get($owner_id)) && $user['email']) {
                $owners[] = $user['id'];
            }
            $reference = $parent->get_value('anchor');
        }
        // suggest to query one of available owners
        if ($owners) {
            $context['text'] .= '<div>' . i18n::ns('Following person is entitled to invite you to participate:', 'Following persons are entitled to invite you to participate:', count($owners)) . '</div>';
            // the form
            $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>' . Users::list_for_ids($owners, 'request') . Skin::finalize_list(array(Skin::build_submit_button(i18n::s('Submit a request to get access'))), 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '">' . '</div></form>';
        }
    }
    // re-enforce the canonical link
} elseif (!$zoom_type && $page == 1 && $context['self_url'] && $whole_rendering && strncmp($context['self_url'], $context['page_link'], strlen($context['page_link']))) {
    Safe::header('Status: 301 Moved Permanently', TRUE, 301);
    Safe::header('Location: ' . $context['page_link']);
    Logger::error(Skin::build_link($context['page_link']));
    // display the article
} else {
    // behaviors can change page menu
    if (is_object($behaviors)) {
        $context['page_menu'] = $behaviors->add_commands('articles/view.php', 'article:' . $item['id'], $context['page_menu']);
    }
    // remember surfer visit
    Surfer::is_visiting(Articles::get_permalink($item), Codes::beautify_title($item['title']), 'article:' . $item['id'], $item['active']);
Exemplo n.º 14
0
        // notify sysops
        Logger::notify('articles/duplicate.php: ' . $label, $description);
    }
    // action has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
    // please confirm
} else {
    // the article or the anchor icon, if any
    $context['page_image'] = $item['icon_url'];
    if (!$context['page_image'] && is_object($anchor)) {
        $context['page_image'] = $anchor->get_icon_url();
    }
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Yes, I want to duplicate this page'), NULL, NULL, 'confirmed');
    if (isset($item['id'])) {
        $menu[] = Skin::build_link(Articles::get_permalink($item), i18n::s('Cancel'), 'span');
    }
    // render commands
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="action" value="duplicate" />' . "\n" . '</p></form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    // the title of the action
    $context['text'] .= Skin::build_block($item['title'], 'title');
    // the introduction text, if any
    $context['text'] .= '<div style="margin: 1em 0;">' . Codes::beautify($item['introduction']) . '</div>' . "\n";
    // get text related to the overlay, if any
    if (is_object($overlay)) {
        $context['text'] .= $overlay->get_text('view', $item);
    }
Exemplo n.º 15
0
Arquivo: check.php Projeto: rair/yacs
        } elseif (!strncmp($key, 'temporary/cache_i18n_locale_', 28)) {
        } elseif (!strncmp(substr($key, -4), '.php', 4)) {
            // one of the parameter files created by yacs
            if (preg_match('/parameters\\/(agents|control|feeds|files|hooks|letters|root|scripts|services|skins|users|virtual_.+)\\.include\\.php$/i', $key)) {
            } elseif (isset($footprints[$key])) {
                $expected = $footprints[$key];
                $actual = Scripts::hash($node);
                if ($expected[0] != $actual[0] || $expected[1] != $actual[1]) {
                    $context['text'] .= sprintf(i18n::s('ERROR: File %s is missing or corrupted.'), $key) . BR . "\n";
                }
            } else {
                $context['text'] .= sprintf(i18n::s('File %s is not part of Yacs.'), $key) . BR . "\n";
            }
            // not a safe file
        } elseif (!preg_match('/\\.(bak|bat|css|done|dtd|fdb|flv|gif|ico|jpeg|jpg|js|jsmin|htc|htm|html|mo|off|on|pdf|png|po|pot|reg|sh|sql|swf|tgz|txt|xml|zip)$/i', $key)) {
            $context['text'] .= sprintf(i18n::s('File %s is not part of Yacs.'), $key) . BR . "\n";
        }
    }
    // ensure enough execution time
    //		Safe::set_time_limit(30);
    // list of updated scripts
    $context['text'] .= '<p>' . i18n::s('Checking scripts...') . BR . "\n";
    Scripts::walk_files_at($context['path_to_root'], 'check_file');
} else {
    // splash message
    $context['text'] .= '<p>' . i18n::s('Click on the button below to check running scripts on your server.') . "</p>\n";
    // propose to update the server
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><p>' . Skin::build_submit_button(i18n::s('Yes, I want to check scripts on this server')) . '<input type="hidden" name="action" value="confirmed" />' . '</p></form>' . "\n";
}
// render the skin
render_skin();
Exemplo n.º 16
0
Arquivo: delete.php Projeto: rair/yacs
            Safe::redirect($anchor->get_url() . '#_attachments');
        } else {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'files/');
        }
    }
    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
} else {
    // commands
    $menu = array();
    $class_submit = $render_overlaid ? 'submit-overlaid' : 'button';
    if (!is_object($overlay) || !($delete_text = strtolower($overlay->get_label('delete_command')))) {
        $delete_text = i18n::s('delete this file');
    }
    $menu[] = Skin::build_submit_button(sprintf(i18n::s('Yes, I want to %s'), $delete_text), NULL, NULL, 'confirmed', $class_submit);
    if (!$render_overlaid) {
        if (isset($item['id'])) {
            $menu[] = Skin::build_link(Files::get_permalink($item), i18n::s('Cancel'), 'span');
        }
    } else {
        $menu[] = '<span><a href="javascript:;" onclick="Yacs.closeModalBox();">' . i18n::s('Cancel') . '</a></span>';
    }
    // the submit button
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . '</p></form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    // use a table for the layout
    $context['text'] .= Skin::table_prefix('form');
    $lines = 1;
    // the title
Exemplo n.º 17
0
     $context['text'] .= '<p>' . sprintf(i18n::s('The following configuration has been saved into the file %s.'), 'parameters/root.include.php') . "</p>\n";
     // first installation
     if (!file_exists('parameters/switch.on') && !file_exists('parameters/switch.off')) {
         $context['text'] .= '<p>' . i18n::s('Review provided information and go to the bottom of the page to move forward.') . "</a></p>\n";
     }
     // purge the cache
     Cache::clear();
     // remember the change
     $label = sprintf(i18n::c('%s has been updated'), 'parameters/root.include.php');
     Logger::remember('configure.php: ' . $label);
 }
 // display updated parameters
 $context['text'] .= Skin::build_box(i18n::s('Configuration parameters'), Safe::highlight_string($content), 'folded');
 // first installation
 if (!file_exists('parameters/switch.on') && !file_exists('parameters/switch.off')) {
     $context['text'] .= '<form method="get" action="control/" id="main_form">' . "\n" . '<p>' . Skin::build_submit_button(i18n::s('Switch the server on')) . '</p>' . "\n" . '</form>' . "\n";
     // ordinary follow-up commands
 } else {
     // what's next?
     $follow_up = i18n::s('Where do you want to go now?');
     // follow-up menu
     $menu = array();
     // front page
     $menu = array_merge($menu, array($context['url_to_root'] => i18n::s('Front page')));
     // control panel
     $menu = array_merge($menu, array('control/' => i18n::s('Control Panel')));
     // do it again
     $menu = array_merge($menu, array('configure.php' => i18n::s('Configure again')));
     // display follow-up commands
     $follow_up .= Skin::build_list($menu, 'menu_bar');
     // at page bottom
Exemplo n.º 18
0
Arquivo: chmod.php Projeto: rair/yacs
        $count++;
        // avoid timeouts
        if (!($count % 50)) {
            Safe::set_time_limit(30);
            SQL::ping();
        }
    }
    if ($count) {
        $context['text'] .= sprintf(i18n::s('%d files have been updated.'), $count) . "\n";
    }
    $context['text'] .= "</p>\n";
    // display the execution time
    $time = round(get_micro_time() - $context['start_time'], 2);
    $context['text'] .= '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
    // forward to the index page
    $menu = array('control/' => i18n::s('Control Panel'));
    $context['text'] .= Skin::build_list($menu, 'menu_bar');
    // remember the operation
    $label = sprintf(i18n::c('chmod %s has been applied to scripts'), $context['file_mask']);
    Logger::remember('control/chmod.php: ' . $label);
    // confirmation is required
} else {
    // the confirmation question
    $context['text'] .= '<b>' . sprintf(i18n::s('You are about to chmod(%d) all running scripts of this server. Are you sure?'), $context['file_mask']) . "</b>\n";
    // the menu for this page
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><p>' . Skin::build_submit_button(i18n::s('Yes, I do want to change permissions of running scripts')) . '<input type="hidden" name="action" value="confirm" />' . '</p></form>' . "\n";
    // this may take several minutes
    $context['text'] .= '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . "</p>\n";
}
// render the skin
render_skin();
Exemplo n.º 19
0
 $fields[] = array($label, $input, $hint);
 // put the set of fields in the page
 $store .= Skin::build_form($fields);
 $fields = array();
 //
 // assemble all tabs
 //
 $all_tabs = array(array('extensions', i18n::s('Extensions'), 'extensions_panel', $extensions), array('store', i18n::s('Storage'), 'store_panel', $store));
 // let YACS do the hard job
 $context['text'] .= Skin::build_tabs($all_tabs);
 //
 // bottom commands
 //
 $menu = array();
 // the submit button
 $menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
 // control panel
 if (file_exists('../parameters/control.include.php')) {
     $menu[] = Skin::build_link('control/', i18n::s('Control Panel'), 'span');
 }
 // all skins
 if (file_exists('../parameters/control.include.php')) {
     $menu[] = Skin::build_link('files/', i18n::s('Files'), 'span');
 }
 // insert the menu in the page
 $context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
 // end of the form
 $context['text'] .= '</div></form>';
 // set the focus
 Page::insert_script('$("#files_extensions").focus();');
 // general help on this form
Exemplo n.º 20
0
     $context['text'] .= '<p><input type="radio" name="action" value="partners" /> ' . i18n::s('Add a section for partners -- the special people or sites that are supporting your site') . '</p>' . "\n";
 }
 // create a cookbook
 $context['text'] .= '<p><input type="radio" name="action" value="recipes" /> ' . i18n::s('Add a cookbook -- cooking recipes, the French secret to happiness') . '</p>' . "\n";
 // create a directory of links
 $context['text'] .= '<p><input type="radio" name="action" value="links" /> ' . i18n::s('Add a directory of links -- a small version of Yahoo!, or of DMOZ') . '</p>' . "\n";
 // create sample server profiles
 $context['text'] .= '<p><input type="radio" name="action" value="servers" /> ' . i18n::s('Add sample server profiles -- ping well-known news aggregator and become famous') . '</p>' . "\n";
 // create basic records
 $context['text'] .= '<p><input type="radio" name="action" value="build" /> ' . i18n::s('Add basic items -- in case you would need to replay some steps of the setup process') . '</p>' . "\n";
 // create a test environment
 if (file_exists($context['path_to_root'] . 'tools/populate.php')) {
     $context['text'] .= '<p><input type="radio" name="action" value="test" /> ' . i18n::s('Add sample items -- for test purpose') . '</p>' . "\n";
 }
 // the submit button
 $context['text'] .= '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Next step'), i18n::s('Press [s] to submit data'), 's') . '</p>' . "\n";
 // end of the form
 $context['text'] .= '</form>' . "\n";
 // the help panel
 $help = '<p>' . i18n::s('Turn any regular section to a photo album by adding images to posted pages.') . '</p>' . '<p>' . i18n::s('YACS creates weekly and monthly archives automatically. No specific action is required to create these.') . '</p>';
 $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
 // contribution shortcuts
 if (Surfer::is_member()) {
     $label = '<p>' . i18n::s('Of course, you may also use regular editors to create simple items:') . "</p>\n";
     $label .= '<ul>' . "\n";
     if (Surfer::is_associate()) {
         $label .= '<li>' . Skin::build_link('sections/edit.php', i18n::s('Add a section'), 'shortcut') . '</li>' . "\n" . '<li>' . Skin::build_link('categories/edit.php', i18n::s('Add a category'), 'shortcut') . '</li>' . "\n";
     }
     $label .= '<li> ' . Skin::build_link('articles/edit.php', i18n::s('Add a page'), 'shorcut') . '</li>' . "\n";
     $label .= '</ul>' . "\n";
     $context['components']['boxes'] .= Skin::build_box(i18n::s('Shortcuts'), $label, 'boxes');
Exemplo n.º 21
0
/**
 * dynamically generate the page
 *
 * @see skins/index.php
 */
function send_body()
{
    global $context, $local;
    // $local is required to localize included scripts
    // include every script that has to be run once
    global $scripts, $scripts_count;
    if (@count($scripts)) {
        // the alphabetical order may be used to control script execution order
        sort($scripts);
        reset($scripts);
        // process each script one by one
        foreach ($scripts as $item) {
            // do not execute on first installation
            if (file_exists('../parameters/switch.on') || file_exists('../parameters/switch.off')) {
                // ensure we have a valid database resource
                if (!$context['connection']) {
                    break;
                }
                // remember this as an event
                Logger::remember('scripts/run_once.php: ' . sprintf(i18n::c('script %s has been executed'), $item));
                // where scripts actually are
                $actual_item = str_replace('//', '/', $context['path_to_root'] . 'scripts/run_once/' . $item);
                // include the script to execute it
                $scripts_count++;
                echo Skin::build_block($item, 'subtitle');
                include $actual_item;
                echo "\n";
            }
            // ensure enough overall execution time
            Safe::set_time_limit(30);
            // stamp the file to remember execution time
            Safe::touch($actual_item);
            // rename the script to avoid further execution
            Safe::unlink($actual_item . '.done');
            Safe::rename($actual_item, $actual_item . '.done');
        }
        // refresh javascript libraries
        Cache::purge('js');
    }
    // report on actual execution
    if ($scripts_count) {
        echo '<p>&nbsp;</p><p>' . sprintf(i18n::ns('%d script has been executed', '%d scripts have been executed', $scripts_count), $scripts_count) . "</p>\n";
    } else {
        echo '<p>' . i18n::s('No script has been executed') . "</p>\n";
    }
    // display the total execution time
    $time = round(get_micro_time() - $context['start_time'], 2);
    if ($time > 30) {
        echo '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
    }
    // if the server has been switched off, go back to the control panel
    if (file_exists('../parameters/switch.off')) {
        echo '<form method="get" action="' . $context['url_to_root'] . 'control/">' . "\n" . '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Control Panel')) . '</p>' . "\n" . '</form>' . "\n";
        // else back to the control panel as well, but without a button
    } else {
        $menu = array('control/' => i18n::s('Control Panel'));
        echo Skin::build_list($menu, 'menu_bar');
    }
    // purge the cache, since it is likely that we have modified some data
    Cache::clear();
}
Exemplo n.º 22
0
                $context['text'] .= '<li>' . $link . '</li>';
            }
            $context['text'] .= "</ul>\n";
        }
    }
    // get script parameters
    $context['text'] .= Skin::build_block(i18n::s('Computation parameters'), 'title');
    // the form to catch the input
    $context['text'] .= '<form method="post" action="fat_index.php" id="main_form"><div>' . "\n";
    // an external reference to parse
    $context['text'] .= '<p>' . sprintf(i18n::s('Web Reference: %s'), '<input type="text" name="reference" size="60" value="' . htmlspecialchars($reference) . '" />') . "\n";
    // with an optional cookie
    $context['text'] .= '<br />' . sprintf(i18n::s('Optional cookie string: %s'), '<input type="text" name="cookie" size="60" value="' . htmlspecialchars($cookie) . '" />') . '</p>' . "\n";
    // or
    $context['text'] .= '<p><i>' . i18n::s('or') . '</i></p>' . "\n";
    // raw input
    $context['text'] .= sprintf(i18n::s('Raw Input: %s'), '<br /><textarea name="input" rows="10" cols="80">' . htmlspecialchars($input) . '</textarea>') . "\n";
    // the submit button
    $context['text'] .= '<p>' . Skin::build_submit_button(i18n::s('Submit'), NULL, NULL, 'action') . '</p>' . "\n" . '</div></form>' . "\n";
    // the filtered text, for visual control
    if (isset($filtered) && $filtered) {
        // section title
        $context['text'] .= Skin::build_block(i18n::s('Visual control of filtered data'), 'title');
        // transcode html entities
        $context['text'] .= '<p>' . htmlentities($filtered) . '</p>' . "\n";
    }
}
// render the skin
// if the current skin has been set to 'foo', YACS includes skins/foo/template.php
// basically, this script uses content of $context[] (e.g., $context['title']) to render the page
render_skin();
Exemplo n.º 23
0
Arquivo: upload.php Projeto: rair/yacs
        $context['text'] .= Skin::build_list($menu, 'menu_bar');
    }
    // clear the cache, to avoid side effects of complex updates
    $context['text'] .= Cache::clear();
    // ask for something to process, except on error
} elseif (!count($context['error'])) {
    // the splash message
    $context['text'] .= '<p>' . i18n::s('This script allows you to install or update a theme for your YACS server.') . "</p>\n";
    // the form to post an file
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form" enctype="multipart/form-data"><div>';
    // upload an archive
    $context['text'] .= '<p>' . i18n::s('Select the archive file that you want to install remotely.') . '</p>';
    // the file
    $context['text'] .= '<input type="file" name="upload" id="focus" size="30" />' . ' (&lt;&nbsp;' . $context['file_maximum_size'] . i18n::s('bytes') . ')';
    // the submit button
    $context['text'] .= '<p>' . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's') . '</p>' . "\n";
    // end of the form
    $context['text'] .= '</div></form>';
    // the script used for form handling at the browser
    Page::insert_script('$("#focus").focus();');
    // use an available archive
    $context['text'] .= '<p>' . i18n::s('Alternatively, this script is able to handle archives that have been put in the directory <code>inbox/skins</code>.') . '</p>';
    // find available skin archives
    $archives = array();
    if ($dir = Safe::opendir("../inbox/skins")) {
        // scan the file system
        while (($file = Safe::readdir($dir)) !== FALSE) {
            // skip special files
            if ($file[0] == '.' || $file[0] == '~') {
                continue;
            }
Exemplo n.º 24
0
Arquivo: search.php Projeto: rair/yacs
// load localized strings
i18n::bind('root');
// load the skin
load_skin('search');
// the title of the page
if ($search) {
    $context['page_title'] = sprintf(i18n::s('Search: %s'), $search);
} else {
    $context['page_title'] = i18n::s('Search');
}
// the form to submit a new search
$context['text'] .= '<form method="get" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
$fields = array();
// a field to type keywords
$label = i18n::s('You are searching for');
$input = '<input type="text" name="search" size="45" value="' . encode_field($search) . '" maxlength="255" />' . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
$hint = i18n::s('Type one or several words.');
$fields[] = array($label, $input, $hint);
// limit the search to one section
$label = i18n::s('Search in');
if ($section_id) {
    $current = 'section:' . $section_id;
} else {
    $current = 'none';
}
$input = '<select name="anchor">' . '<option value="">' . i18n::s('-- All sections') . "</option>\n" . Sections::get_options($current, 'no_subsections') . '</select>';
$hint = i18n::s('Look in all or only one section.');
$fields[] = array($label, $input, $hint);
// build the form
$context['text'] .= Skin::build_form($fields);
$fields = array();
Exemplo n.º 25
0
Arquivo: delete.php Projeto: rair/yacs
    // delete and go back to the anchor or to the index page
    if (Tables::delete($item['id'])) {
        Tables::clear($item);
        if (is_object($anchor)) {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . $anchor->get_url());
        } else {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'articles/');
        }
    }
    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
} else {
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Yes, I want to delete this table'), NULL, NULL, 'confirmed');
    if (is_object($anchor)) {
        $menu[] = Skin::build_link($anchor->get_url(), i18n::s('Cancel'), 'span');
    }
    // the submit button
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . '</p></form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    // the title of the table
    if (isset($item['title'])) {
        $context['text'] .= Skin::build_block($item['title'], 'title');
    }
    // display the full text
    $context['text'] .= Skin::build_block($item['description'], 'description');
    // execute the query string to build the table
    if (isset($item['query']) && $item['query']) {
Exemplo n.º 26
0
Arquivo: panel.php Projeto: rair/yacs
// the title of the page
$context['page_title'] = i18n::s('New page');
// the form to edit an article
$context['text'] .= '<form method="post"' . ' action="' . $context['url_to_root'] . 'articles/edit.php" target="' . htmlspecialchars($target) . '" id="side_form">';
// the section
// $context['text'] .= '<p>'.i18n::s('Section').BR
// 	.'<select name="anchor">'.Sections::get_options().'</select>'
// 	.'</p>'."\n";
// the title
$context['text'] .= '<p>' . i18n::s('Title') . BR . '<textarea name="title" id="title" rows="2" cols="20" accesskey="t"></textarea>' . '</p>' . "\n";
// the introduction
$context['text'] .= '<p>' . i18n::s('Introduction') . BR . '<textarea name="introduction" rows="3" cols="20" accesskey="i"></textarea>' . '</p>' . "\n";
// the description label
$context['text'] .= '<p>' . i18n::s('Page content') . BR . '<textarea name="text" rows="10" cols="20" accesskey="c"></textarea>' . '</p>' . "\n";
// the submit and reset buttons
$context['text'] .= '<p>' . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's', NULL, 'no_spin_on_click') . '</p>' . "\n";
// end of the form
$context['text'] .= '</form>';
// handle the output correctly
render_raw();
// if it was a HEAD request, stop here
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'HEAD') {
    return;
}
// add language information, if known
if (isset($context['page_language'])) {
    $language = ' xml:lang="' . $context['page_language'] . '" ';
} else {
    $language = '';
}
// do our own rendering
Exemplo n.º 27
0
Arquivo: select.php Projeto: rair/yacs
     // break an assignment, and also purge the watch list
 } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset' && isset($_REQUEST['member'])) {
     Members::free($_REQUEST['anchor'], $_REQUEST['member']);
     if (preg_match('/^user:/', $_REQUEST['anchor'])) {
         Members::free($_REQUEST['member'], $_REQUEST['anchor']);
     }
 }
 // insert anchor prefix
 if (is_object($anchor)) {
     $context['text'] .= $anchor->get_prefix();
 }
 // the current list of linked sections
 $sections =& Members::list_sections_by_title_for_anchor($anchor->get_reference(), 0, SECTIONS_LIST_SIZE, 'raw');
 // the form to link additional sections
 if (!is_array($sections) || count($sections) < SECTIONS_LIST_SIZE) {
     $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><p>' . i18n::s('To assign a section, look in the content tree below and assign one section at a time') . BR . '<select name="member">' . Sections::get_options(NULL, $sections) . '</select>' . ' ' . Skin::build_submit_button(' >> ') . '<input type="hidden" name="anchor" value="' . encode_field($anchor->get_reference()) . '">' . '<input type="hidden" name="action" value="set">' . '</p></form>' . "\n";
 }
 // splash
 $context['text'] .= '<p style="margin-top: 2em;">' . sprintf(i18n::s('This is the list of sections assigned to %s'), $anchor->get_title()) . '</p>';
 // layout assigned sections
 if ($sections) {
     // browse the list
     foreach ($sections as $id => $section) {
         // get the related overlay, if any
         $overlay = Overlay::load($section, 'section:' . $id);
         // get parent anchor
         $parent = Anchors::get($section['anchor']);
         // the url to view this item
         $url = Sections::get_permalink($section);
         // use the title to label the link
         if (is_object($overlay)) {
Exemplo n.º 28
0
Arquivo: fetch.php Projeto: rair/yacs
    if (Files::assign($item['id'], $user)) {
        // inform surfer
        $context['text'] .= '<p>' . sprintf(i18n::s('You have reserved this file, and you are encouraged to %s as soon as possible, or to %s.'), Skin::build_link(Files::get_url($item['id'], 'edit'), i18n::s('upload an updated version'), 'basic'), Skin::build_link(Files::get_url($item['id'], 'fetch', 'release'), i18n::s('release reservation'), 'basic')) . '</p>';
        // help the surfer
    } else {
        Logger::error(i18n::s('Operation has failed.'));
    }
    // follow-up commands
    $context['text'] .= Skin::build_block(Skin::build_link($anchor->get_url('files'), i18n::s('Done'), 'button'), 'bottom');
    // file has been reserved, and surfer is not owner
} elseif ($action != 'confirm' && isset($item['assign_id']) && $item['assign_id'] && !Surfer::is($item['assign_id'])) {
    // inform surfer
    $context['text'] .= Skin::build_block(sprintf(i18n::s('This file has been assigned to %s %s, and it is likely that an updated version will be made available soon.'), Users::get_link($item['assign_name'], $item['assign_address'], $item['assign_id']), Skin::build_date($item['assign_date'])), 'caution');
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Download this file'), NULL, NULL, 'confirmed', 'no_spin_on_click');
    $menu[] = Skin::build_link($anchor->get_url('files'), i18n::s('Cancel'), 'span');
    // to get the actual file
    $target_href = $context['url_to_home'] . $context['url_to_root'] . Files::get_url($item['id'], 'fetch', $item['file_name']);
    // render commands
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>' . "\n" . Skin::finalize_list($menu, 'assistant_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="action" value="confirm" />' . "\n" . '</div></form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    //actual transfer
} elseif ($item['id'] && $item['anchor']) {
    // increment the count of downloads
    if (!Surfer::is_crawler()) {
        Files::increment_hits($item['id']);
    }
    // record surfer activity
    Activities::post('file:' . $item['id'], 'fetch');
Exemplo n.º 29
0
Arquivo: select.php Projeto: rair/yacs
                $where .= " OR categories.active='N'";
            }
            // only consider live categories
            $where = '(' . $where . ')' . ' AND ((categories.expiry_date is NULL)' . "\tOR (categories.expiry_date <= '" . NULL_DATE . "') OR (categories.expiry_date > '" . $context['now'] . "'))";
            // limit the query to top level only
            $query = "SELECT categories.id, categories.title " . " FROM " . SQL::table_name('categories') . " AS categories " . " WHERE (" . $where . ") AND (categories.anchor='category:" . $category_id . "')" . " ORDER BY categories.title";
            $result = SQL::query($query);
            $sub_categories = array();
            while ($result && ($option = SQL::fetch($result))) {
                $sub_categories['category:' . $option['id']] = $option['title'];
            }
            if (count($sub_categories)) {
                $suffix .= '<form method="post" action="' . $context['script_url'] . '"><div>' . i18n::s('More specific:') . ' <select name="anchor">';
                foreach ($sub_categories as $option_reference => $option_label) {
                    $suffix .= '<option value="' . $option_reference . '">' . $option_label . "</option>\n";
                }
                $suffix .= '</select>' . ' ' . Skin::build_submit_button(" >> ") . '<input type="hidden" name="member" value="' . $member . '">' . '<input type="hidden" name="father" value="category:' . $category_id . '">' . '</div></form>' . "\n";
            }
            // format the item
            $new_categories[$url] = array($prefix, $label, $suffix, $type, $icon);
        }
        // display attached categories with unlink buttons
        $context['text'] .= Skin::build_list($new_categories, 'decorated');
    }
    // insert anchor suffix
    if (is_object($anchor)) {
        $context['text'] .= $anchor->get_suffix();
    }
}
// render the skin
render_skin();
Exemplo n.º 30
0
    $fields[] = array($label, $input);
    // server salt
    $label = i18n::s('Security salt');
    $input = '<input type="text" name="bbb_salt" id="bbb_salt" size="32" value="' . encode_field(isset($context['bbb_salt']) ? $context['bbb_salt'] : '') . '" maxlength="255" />';
    $fields[] = array($label, $input);
    // build the form
    $context['text'] .= Skin::build_form($fields);
    $fields = array();
    // bottom commands
    $menu = array();
    // the submit button
    $local['submit_en'] = 'Submit';
    $local['submit_fr'] = 'Enregistrer';
    $local['title_en'] = 'Press [s] to save data';
    $local['title_fr'] = 'Appuyer sur [s] pour enregistrer les donn&eacute;es';
    $menu[] = Skin::build_submit_button(i18n::user('submit'), i18n::user('title'), 's');
    // control panel
    $menu[] = Skin::build_link('control/', i18n::user('Control Panel'), 'span');
    // insert the menu in the page
    $context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
    // end of the form
    $context['text'] .= '</form>';
    // no modifications in demo mode
} elseif (file_exists($context['path_to_root'] . 'parameters/demo.flag')) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // save updated parameters
} else {
    // build the new configuration file
    $content = '<?php' . "\n" . '// This file has been created by the configuration script overlays/bbb_meetings/configure.php' . "\n" . '// on ' . gmdate("F j, Y, g:i a") . ' GMT, for ' . Surfer::get_name() . '. Please do not modify it manually.' . "\n";
    if (isset($_REQUEST['bbb_server'])) {