예제 #1
0
             $custom_style_form->append($item);
             $item = new SubmitInput('Submit');
             $custom_style_form->append($item);
         } else {
             if (get_item($dbh, "stylesheet", "stylesheet", "userid", $idcookie)) {
                 set_item($dbh, "stylesheet", "stylesheet", $urcss, "userid", $idcookie);
             } else {
                 add_row($dbh, "stylesheet", array($idcookie, $urcss));
             }
             $message = new InfoText('Style Set', 'Success');
             $thispage->append($message);
         }
     } else {
         delete_item($dbh, "stylesheet", "userid", $idcookie);
         $style = $_POST['style'];
         set_item($dbh, "display", "style", $style, "userid", $idcookie);
         //set the style that they selected
         $message = new InfoText('Style Set', 'Success');
         $thispage->append($message);
     }
     //if $style=custome, else
 }
 populate_page($thispage, $dbh, $idcookie);
 $my_result = mysql_query("Select style,descr From \n\t\t\t\t  style");
 //get currently available styles and their descriptions
 while ($new_row = mysql_fetch_row($my_result)) {
     $mystyles[] = $new_row;
 }
 $css = get_item($dbh, "stylesheet", "stylesheet", "userid", $idcookie);
 if ($css) {
     $customstyle = "checked";
예제 #2
0
require_once "../Plans.php";
$username = $_POST['username'];
require "auth.php";
?>

<html>
<body>
<?php 
require "dbfunctions.php";
$dbh = db_connect();
if ($username) {
    $usersid = get_item($dbh, "userid", "accounts", "username", $username);
    if ($mysubmit) {
        $newmessage = preg_replace("/\n/s", "<br>", $newmessage);
        $newmessage = addslashes($newmessage);
        set_item($dbh, "accounts", "spec_message", $newmessage, "userid", $usersid);
        echo "Private message for <b>" . $username . "</b> set to:<br><br>" . stripslashes(stripslashes($newmessage));
    } else {
        //not submitted, so show spec_message
        $spec_message = get_item($dbh, "spec_message", "accounts", "userid", $usersid);
        ?>
<form action="changespec.php" method="POST">
<textarea name="newmessage" cols="70" rows="14" wrap="physical">
<?php 
        echo $spec_message;
        ?>
</textarea><br>
<input type="hidden" name="mysubmit" value="1">
<input type="hidden" name="username" value="<?php 
        echo $username;
        ?>
예제 #3
0
$theme_settings = return_if_array_key_exists('theme_settings', $active_theme);
if ($theme_settings) {
    if (is_array(get_active_theme_vars('theme_items'))) {
        foreach (get_active_theme_vars('theme_items') as $namespace => $items) {
            // Si l'item à été enregistré dans les réglages du thèmes
            if (array_key_exists($namespace, $theme_settings)) {
                $item_settings = $theme_settings[$namespace];
                $api = get_apis(return_if_array_key_exists('declared_apis', $item_settings));
                $callback = return_if_array_key_exists('callback', $api);
                if ($callback) {
                    if (is_array($callback)) {
                        if (method_exists($callback[0], $callback[1])) {
                            // We dont consider Item IF setting limit result to 0
                            if ((int) $item_settings['api_limit'] > 0) {
                                $returned = $callback[0]->{$callback}[1]($item_settings['api_limit']);
                                // Set Item With Returned datas from API
                                if (is_array($returned)) {
                                    foreach ($returned as $r) {
                                        set_item($namespace, $r);
                                    }
                                }
                            }
                        }
                    }
                }
                //
            }
        }
    }
    get_core_vars('active_theme_object')->home();
}
예제 #4
0
require "syntax-classes.php";
//load display functions
$dbh = db_connect();
//connect to the database
$idcookie = User::id();
$thispage = new PlansPage('Preferences', 'interfaces', PLANSVNAME . ' - Interfaces', 'interfaces.php');
if (!User::logged_in()) {
    populate_guest_page($thispage);
    $denied = new AlertText('You are not allowed to edit as a guest.', 'Access Denied');
    $thispage->append($denied);
} else {
    populate_page($thispage, $dbh, $idcookie);
    $heading = new HeadingText('Interface Options', 2);
    $thispage->append($heading);
    if ($part) {
        set_item($dbh, "display", "interface", $interface, "userid", $idcookie);
        //set which interface they selected
        //Let user know the interface has been set
        $message = new InfoText('Interface set.', 'Success');
        $thispage->append($message);
    } else {
        $my_result = mysql_query("Select interface,descr From \ninterface");
        //get the current interfaces and descriptions
        while ($new_row = mysql_fetch_row($my_result)) {
            $myinterfaces[] = $new_row;
        }
        $intcheck[get_item($dbh, "interface", "display", userid, $idcookie)] = " checked";
        //get user's current selection, and set it to the index of an array and put value to checked
        //begin the form
        $interfaceform = new Form('interfacesform', true);
        $thispage->append($interfaceform);
예제 #5
0
     $rectime = microtime();
     if (empty($recorduri)) {
         set_item('recorduri', generate_uri($rectime));
     }
     //else {
     //	set_item('recorduri', generate_uri($rectime));
     //}
     set_item('serviceid', $myservice);
     set_item('servicesub', $myservsub);
     set_item('calltime', time_long($rectime));
     set_item('loadtime', time_long($rectime));
     //	'exporttime' LEAVE NULL
     //	'senttime' LEAVE NULL
     set_item('loadagent', $agentinit);
     foreach ($_POST["item"] as $fishkey => $fishvalue) {
         set_item($fishkey, $fishvalue);
     }
     //echo "----------------------------------------\n";
     //echo "Submit-{$query}\n";
     $query = "insert into itr_requests set itr_description='" . mysql_real_escape_string($itr_description) . "', itr_raised=now(), itr_raisedby='{$agentinit}';";
     //mysql_query($query);
     //echo "Submit-{$query}\n";
     $itr_record = mysql_insert_id();
     $itr_id = substr($itr_record, -3);
     $query = "update itr_requests set itr_id='{$itr_id}' where itr_record='{$itr_record}' limit 1;";
     //mysql_query($query);
     $recorduri = '';
     //}
 }
 echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>';
 echo '<input type="hidden" name="service" value="' . $myservice . '" />';
예제 #6
0
$idcookie = User::id();
// Create the new page
$page = new PlansPage('Preferences', 'planname', PLANSVNAME . ' - Change Name', 'changename.php');
if (!User::logged_in()) {
    populate_guest_page($page);
    //tell them not able to use page
    $page->append(new AlertText("You are not allowed to edit this option as a guest.", false));
    interface_disp_page($page);
} else {
    populate_page($page, $dbh, $idcookie);
    $title = new HeadingText('Change Name', 1);
    $page->append($title);
    if ($changed == 1) {
        $user_name = htmlspecialchars($user_name);
        //strip out html chars
        set_item($dbh, "accounts", "pseudo", $user_name, "userid", $idcookie);
        //set pseudoname in database
        $message = new InfoText("Name changed to <b>" . stripslashes($user_name) . "</b>.", NULL);
        //tell user their name has been changed
        $page->append($message);
    } else {
        //if not changing name, give form
        $old_name = stripslashes(get_item($dbh, "pseudo", "accounts", "userid", $idcookie));
        //get old name
        /* create the page and form */
        $nameform = new Form('changename', 'Change Name');
        $page->append($nameform);
        $nameform->action = 'changename.php';
        $nameform->method = 'POST';
        /* add fields to the form */
        $item = new TextInput('user_name', $old_name);
예제 #7
0
function blockToCode($block)
{
    if ($block == NULL) {
        return '';
    }
    if ($block->nodeName != 'block') {
        echo "xml Wrong";
        echo $block->nodeName;
        return '';
    }
    $type = $block->getAttribute('type');
    switch ($type) {
        case 'controls_if':
            return controls_if($block);
            break;
        case 'logic_boolean':
            return logic_bool($block);
            break;
        case 'logic_compare':
            return logic_compare($block);
            break;
        case 'logic_operation':
            return logic_operation($block);
            break;
        case 'logic_negate':
            return logic_negate($block);
            break;
        case 'logic_ternary':
            return logic_ternary($block);
            break;
        case 'logic_null':
            return logic_null($block);
            break;
        case 'controls_whileUntil':
            return controls_whileUntil($block);
            break;
        case 'controls_flow_statements':
            return controls_flow_statements($block);
            break;
        case 'io_buzzer':
            return buzzer_msec($block);
            break;
        case 'text':
            return textvalue($block);
            break;
        case 'text_print':
            return prints($block);
            break;
        case 'math_number':
            return math_number($block);
            break;
        case 'motion':
            return motion($block);
            break;
        case 'turn':
            return turn($block);
            break;
        case 'soft_turn':
            return soft_turn($block);
            break;
        case 'back_turn':
            return back_turn($block);
            break;
        case 'position_motion':
            return position_motion($block);
            break;
        case 'position_turn':
            return position_turn($block);
            break;
        case 'position_turn_soft':
            return position_turn_soft($block);
            break;
        case 'position_turn_back':
            return position_turn_back($block);
            break;
        case 'sensor_white':
            return sensor_white($block);
            break;
        case 'sensor_sharp':
            return sensor_sharp($block);
            break;
        case 'sensor_ir':
            return sensor_ir($block);
            break;
        case 'buzzer_on':
            return buzzer_on($block);
            break;
        case 'buzzer_off':
            return buzzer_off($block);
            break;
        case 'delay_ms':
            return delay_ms($block);
            break;
        case 'math_arithmetic':
            return math_arithmetic($block);
            break;
        case 'math_single':
            return math_single($block);
            break;
        case 'math_trig':
            return math_trig($block);
            break;
        case 'math_modulo':
            return math_modulo($block);
            break;
        case 'register':
            return register($block);
            break;
        case 'pin':
            return pin($block);
            break;
        case 'set_item':
            return set_item($block);
            break;
        case 'call_function':
            return call_function($block);
            break;
        case 'call_function_with_return':
            return call_function_with_return($block);
            break;
        case 'function_defreturn':
            return function_defreturn($block);
            break;
        case 'function_defnoreturn':
            return function_defnoreturn($block);
            break;
        case 'procedures_callnoreturn':
            return procedures_callnoreturn($block);
            break;
        case 'procedures_callreturn':
            return procedures_callreturn($block);
            break;
        case 'hex':
            return hex($block);
            break;
        case 'return':
            return returnr($block);
            break;
        case 'variable_get':
            return variable_get($block);
            break;
        case 'incl_ude':
            return incl_ude($block);
            break;
        case 'define':
            return def_ine($block);
            break;
        default:
            echo "not defined in blockToCode " . $block->getAttribute('type');
    }
}
예제 #8
0
     if ($cols > 150 or $cols < 25) {
         $denied = new AlertText('Column size is not valid.', 'Problem With Your Selection');
         $thispage->append($denied);
     } else {
         if ($rows < 5 or $rows > 50) {
             $denied = new AlertText('Row size is not valid.', 'Problem With Your Selection');
             $thispage->append($denied);
         } else {
             set_item($dbh, "accounts", "edit_cols", $cols, "userid", $idcookie);
             //update the column size
             set_item($dbh, "accounts", "edit_rows", $rows, "userid", $idcookie);
             //update the row size
             if ($notes_asc != 1) {
                 $notes_asc = 0;
             }
             set_item($dbh, "accounts", "notes_asc", $notes_asc, "userid", $idcookie);
             //update the row size
             $message = new AlertText("Row size set to <b>" . $rows . "</b>." . " <br>Column size set to <b>" . $cols . "</b>.", 'Submission Successful');
             $thispage->append($message);
         }
     }
     //else
     //actually tell the user here if there was a problem, or if things were set correctly.
 } else {
     $edsizes = get_items($dbh, "edit_cols, edit_rows, notes_asc", "accounts", "userid", $idcookie);
     //gets the columns and row size
     //gives form
     $textboxform = new Form('textbox_form', true);
     $textboxform->action = 'textbox.php';
     $textboxform->method = 'POST';
     $thispage->append($textboxform);
예제 #9
0
// If user is not authorized, turn them away.
if (!User::logged_in()) {
    populate_guest_page($thispage);
    $denied = new AlertText('You are not allowed to edit as a guest.', 'Access Denied');
    $thispage->append($denied);
} else {
    //allowed to edit
    populate_page($thispage, $dbh, $idcookie);
    $heading = new HeadingText('Guest Viewable', 1);
    $thispage->append($heading);
    // If the form was submitted, set the preference and print a message
    if ($part) {
        if ($webview != 1) {
            $webview = 0;
        }
        set_item($dbh, "accounts", "webview", $webview, "userid", $idcookie);
        $thisitem = new InfoText('Preference set.', '');
        $thispage->append($thisitem);
    }
    $q = Doctrine_Query::create()->from('Block b')->where('b.blocking_user_id = ?', $idcookie)->count();
    $has_blocks = $q != 0;
    if ($has_blocks) {
        $warning = new AlertText("Warning! You are currently blocking some users. Making your plan viewable to guests will allow blocked users to read your plan simply by logging out. To see the list of users you are blocking, visit <a href=\"/blocks.php\">the blocking page</a>.");
        $thispage->append($warning);
    }
    // Make our form
    $viewableform = new Form('guestviewableform', true);
    $thispage->append($viewableform);
    $viewableform->action = 'webview.php';
    $viewableform->method = 'POST';
    if (get_item($dbh, "webview", "accounts", "userid", $idcookie) == 1) {