コード例 #1
0
ファイル: ac_common.php プロジェクト: Kloadut/noalyss_ynh
/**
 * show the module
 * @global $g_user
 * @param $module the $_REQUEST['ac'] exploded into an array
 * @param  $idx the index of the array : the AD code is splitted into an array thanks the slash
 */
function show_menu($module)
{
    if ($module == 0) {
        return;
    }
    static $level = 0;
    global $g_user;
    $cn = Dossier::connect();
    /**
     * Show the submenus
     */
    $amenu = $cn->get_array("\n        select \n            pm_id,\n            me_code,\n            pm_id_dep,\n            me_file,\n            me_javascript,\n            me_url,\n            me_menu,\n            me_description,\n            me_description_etendue\n            from profile_menu \n            join menu_ref using (me_code) \n            where pm_id_dep=\$1 and p_id=\$2\n\t order by p_order", array($module, $g_user->get_profile()));
    // There are submenuS, so show them
    if (!empty($amenu) && count($amenu) > 1) {
        $a_style_menu = array('topmenu', 'menu2', 'menu3');
        if ($level > count($a_style_menu)) {
            $style_menu = 'menu3';
        } else {
            $style_menu = $a_style_menu[$level];
        }
        require 'template/menu.php';
    } elseif (count($amenu) == 1) {
        if (trim($amenu[0]['me_url']) != "" || trim($amenu[0]['me_file']) != "" || trim($amenu[0]['me_javascript']) != "") {
            echo '<div class="topmenu">';
            echo h2info(_($amenu[0]['me_menu']));
            echo '</div>';
            $module = $amenu[0]['pm_id'];
        } else {
            $url = $_REQUEST['ac'] . '/' . $amenu[0]['me_code'];
            echo '<a href="do.php?gDossier=' . Dossier::id() . '&ac=' . $url . '">';
            echo _($amenu[0]['me_menu']);
            echo '</a>';
            $level++;
            return;
        }
    }
    // There is no submenu or only one
    if (empty($amenu) || count($amenu) == 1) {
        $file = $cn->get_array("select me_file,me_parameter,me_javascript,me_type\n\t\tfrom menu_ref\n\t\tjoin profile_menu using (me_code)\n\t\tjoin profile_user using (p_id)\n\t\twhere\n\t\tpm_id=\$1 and\n\t\tuser_name=\$2 and\n\t\t(me_file is not null or trim(me_file) <>'' or\n\t\tme_javascript is not null or trim (me_javascript) <> '')", array($module, $g_user->login));
        if (count($file) == 0) {
            return;
        }
        if ($file[0]['me_file'] != "") {
            if ($file[0]['me_parameter'] !== "") {
                // if there are paramter put them in superglobal
                $array = compute_variable($file[0]['me_parameter']);
                put_global($array);
            }
            if (DEBUG) {
                echo $file[0]['me_file'], " param : ", $file[0]['me_parameter'];
            }
            /*
             * Log the file we input to put in the folder test-noalyss for replaying it
             */
            if (LOGINPUT) {
                $file_loginput = fopen($_ENV['TMP'] . '/scenario-' . $_SERVER['REQUEST_TIME'] . '.php', 'a+');
                fwrite($file_loginput, "include '" . $file[0]['me_file'] . "';");
                fwrite($file_loginput, "\n");
                fclose($file_loginput);
            }
            // if file is not a plugin, include the file, otherwise
            // include the plugin launcher
            if ($file[0]['me_type'] != 'PL') {
                require_once $file[0]['me_file'];
            } else {
                require 'extension_get.inc.php';
            }
            exit;
        }
        if ($file[0]['me_javascript'] != '') {
            $js = str_replace('<DOSSIER>', dossier::id(), $file[0]['me_javascript']);
            echo create_script($js);
        }
    }
    $level++;
}
コード例 #2
0
 * - t title
 * - de description
 * for update, same as ADD +
 * - i id
 * for delete
 * - gDossier
 * - i id
 */
define('ALLOWED', 1);
require_once '../include/constant.php';
require_once NOALYSS_INCLUDE . '/class_dossier.php';
require_once NOALYSS_INCLUDE . '/class_todo_list.php';
require_once NOALYSS_INCLUDE . '/class_database.php';
require_once NOALYSS_INCLUDE . '/class_user.php';
mb_internal_encoding("UTF-8");
$cn = Dossier::connect();
global $g_user;
$g_user = new User($cn);
$g_user->check(true);
$g_user->check_dossier(Dossier::id(), true);
set_language();
ajax_disconnected('add_todo_list');
////////////////////////////////////////////////////////////////////////////////
// Display the note
////////////////////////////////////////////////////////////////////////////////
if (isset($_REQUEST['show'])) {
    $cn = new Database(dossier::id());
    $todo = new Todo_list($cn);
    $todo->set_parameter('id', $_REQUEST['id']);
    $todo->load();
    $content = $todo->display();