*/ $tab = sumo_get_node_info($_GET['id'], 'id', FALSE); $tpl['GET:UpdateForm'] = sumo_get_form_req('', 'modify_node', 'id=' . $tab['id']); $tpl['PUT:Protocol'] = sumo_put_node_protocol($tab['protocol']); $tpl['PUT:NodeName'] = "<input type='text' size='25' name='name' value='" . $tab['name'] . "'>"; $tpl['PUT:Host'] = "<input type='text' size='25' name='host' value='" . $tab['host'] . "'>"; $tpl['PUT:Port'] = "<input type='text' size='7' name='port' value='" . $tab['port'] . "'>"; $tpl['PUT:SumoPath'] = "<input type='text' size='25' name='sumo_path' value='" . $tab['sumo_path'] . "'>"; $tpl['BUTTON:Back'] = "<input type='button' class='button-red' value='" . $language["Back"] . "' onclick='javascript:sumo_ajax_get(\"network\",\"?module=network&action=view_node&id=" . $tab['id'] . "\");'>"; $tpl['LINK:Add'] = sumo_verify_permissions(4, 'sumo') ? sumo_get_action_icon("network", "add_node", "network.content", "?module=network&action=new_node&decoration=false") : sumo_get_action_icon("", "add_node"); $tpl['LINK:Edit'] = sumo_get_action_icon("", "edit_node"); // Change status if ($tab['active']) { $tpl['GET:Status'] = "<font class='status-green'>" . $language['Active'] . "</font>"; $tpl['PUT:Status'] = "<select name='status'>\n<option value='1'>" . $language['Enable'] . "</option>\n<option value='0'>" . $language['Disable'] . "</option>\n</select>"; } else { $tpl['GET:Status'] = "<font class='status-red'>" . $language['Disabled'] . "</font>"; $tpl['PUT:Status'] = "<select name='status'>\n<option value='0'>" . $language['Disable'] . "</option>\n<option value='1'>" . $language['Enable'] . "</option>\n</select>"; } // if it's current node if ($tab['ip'] == $SUMO['server']['ip']) { $tpl['MESSAGE:M'] = $language['NodeWarning']; $tpl['PUT:Host'] = $tab['ip'] . "<input type='hidden' name='host' value='" . $tab['host'] . "'>"; $tpl['PUT:Status'] = ""; } if (sumo_verify_permissions(7, 'sumo') && $tab['id'] > 1) { $msg = sumo_get_simple_rand_string(4, "123456789"); $tpl['LINK:Remove'] = "<div class='sub-module-icon' " . "onmouseover='this.style.outline=\"1px solid #999999\";this.style.background=\"#FFFFFF\"' " . "onmouseout='this.style.outline=\"\";this.style.background=\"\"'>" . "<a href=\"javascript:" . "sumo_show_message('msg{$msg}', '" . htmlspecialchars(sumo_get_message('AreYouSureDeleteNode', $tab['name'])) . "', \n\t\t\t\t\t\t\t\t 'h', 0, \n\t\t\t\t\t\t\t\t '" . base64_encode(sumo_get_form_req('', 'erase_node', 'id=' . $tab['id'])) . "',\n\t\t\t\t\t\t\t\t '" . base64_encode('') . "',\n\t\t\t\t\t\t\t\t '" . base64_encode("<input type='button' value='" . $language['Cancel'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");' class='button'>") . "',\n\t\t\t\t\t\t\t\t '" . base64_encode("<input type='submit' value='" . $language['Ok'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");' class='button'>") . "'\n\t\t\t\t\t\t\t\t);\">" . "<img src='themes/" . $SUMO['page']['theme'] . "/images/modules/network/remove_node.png' vspace='4'><br>" . $language['Remove'] . "</a>" . "</div>"; } else { $tpl['LINK:Remove'] = sumo_get_action_icon("", "remove_node"); }
/** * Enter description here... * * @param unknown_type $module * @param unknown_type $action * @param unknown_type $message * @param unknown_type $level * @param unknown_type $form * @param unknown_type $confirm * @param unknown_type $autoclose * @param unknown_type $b1 * @param unknown_type $b2 * @param unknown_type $b3 * @return unknown */ function sumo_get_message_icon($module = '', $action = '', $message = '', $level = 'h', $form = '', $confirm = '', $autoclose = 0, $b1 = '', $b2 = '', $b3 = '') { global $SUMO, $language; $name = sumo_get_simple_rand_string(); $message = htmlspecialchars($message); $level = strtolower($level); $autoclose = intval($autoclose); $forms = base64_encode($form); $button1 = base64_encode($b1); $button2 = $b2 ? base64_encode($b2) : base64_encode("<input type='button' value='" . $language['Cancel'] . "' onclick='javascript:sumo_remove_window(\"{$name}\");' class='button'>"); $button3 = $b3 ? base64_encode($b3) : base64_encode("<input type='submit' value='" . $language['Ok'] . "' onclick='javascript:sumo_remove_window(\"{$name}\");' class='button'>"); $link = "onclick=\"javascript:sumo_show_message('{$name}', '{$message}', '{$level}', {$autoclose}, '{$form}', '{$button1}', '{$button2}', '{$button3}');\""; $m = $module ? $module : $_SESSION['module']; $a = $action ? $action : $_SESSION['action']; $active = $a == $_SESSION['action'] || !$message ? "style='color: #999999'" : ""; $hover = $a != $_SESSION['action'] || !$message ? "onmouseover='this.style.outline=\"1px solid #999999\";this.style.background=\"#FFFFFF\"' " . "onmouseout='this.style.outline=\"\";this.style.background=\"\"'" : ""; return "<div class='sub-module-icon' {$active} {$hover} {$link}>" . "<img src='themes/" . $SUMO['page']['theme'] . "/images/modules/" . $m . "/" . $a . ".png' vspace='4'><br>" . $language[$a] . "</div>"; }
/** * ADD registration request (set action=1) and wait user confirm * * @author Alberto Basso */ function sumo_request_pwdlost() { global $SUMO, $sumo_lang_login, $sumo_reg_data; $new_pwd = sumo_get_rand_string(8); $reg_code = sumo_get_simple_rand_string(40); $user = sumo_get_user_info($sumo_reg_data['reg_email'], 'email'); sumo_delete_user_temp(); // Delete old temp users sumo_delete_user_temp($sumo_reg_data['reg_email'], 9); // delete all previous requests $query = "INSERT INTO " . SUMO_TABLE_USERS_TEMP . " \r\n\t\t\t (username, action, email, language, password, reg_group, reg_code, time)\r\n\t\t\t VALUES (\r\n\t\t\t\t '" . $user['user'] . "', 2, \r\n\t\t\t\t '" . $sumo_reg_data['reg_email'] . "', \r\n\t\t\t\t '" . $user['language'] . "', \r\n\t\t\t\t '" . sha1($new_pwd) . "', \r\n\t '" . $SUMO['page']['reg_group'] . "', \r\n\t '" . $sumo_reg_data['reg_email'] . "', \r\n\t\t\t\t '" . $reg_code . "',\r\n\t\t\t\t " . $SUMO['server']['time'] . "\r\n\t\t\t\t )"; $SUMO['DB']->Execute($query); $link = $_SERVER['HTTPS'] ? 'https://' : 'http://'; $link .= $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"] . '?sumo_action=changepwd®_code=' . $reg_code; $name = sumo_get_accesspoint_name($SUMO['page']['name'], $_COOKIE['language']); $message = sumo_get_message('I00104M', array($user['user'], $sumo_reg_data['reg_email'], date($SUMO['config']['server']['date_format'] . " " . $SUMO['config']['server']['time_format'], $SUMO['server']['time']), "\"" . $name . "\"", intval($SUMO['config']['accounts']['registration']['life']), $link, $new_pwd)); // Send e-mail to confirm if (!$SUMO['config']['server']['admin']['email']) { sumo_write_log('E06000X', '', '0,1', 2, 'system', FALSE); } else { $m = new Mail(); $m->From($SUMO['config']['server']['admin']['email']); $m->To($sumo_reg_data['reg_email']); $m->Subject($sumo_lang_login['PasswordLost']); $m->Body($message, SUMO_CHARSET); $m->Priority(3); $m->Send(); } }
/** * Function to parsing template file * if $tpl_file = 1 load template file, not process content. * * @global resource $SUMO * @author Alberto Basso <*****@*****.**> */ function sumo_process_template($template_file, $assign, $tpl_file = 0, $theme = '') { global $SUMO, $language; if (!$theme) { $theme = $SUMO['page']['theme']; } if ($tpl_file == 1) { $template_file = @file_get_contents(SUMO_PATH . '/themes/' . $theme . '/' . $template_file); /* $tpl_file_in = SUMO_PATH.'/themes/'.$theme.'/'.$template_file; $tpl_file_out = SUMO_PATH.'/tmp/templates/'.($template_file); if (($SUMO['server']['time'] - @filemtime($tpl_file_out)) < 60) { $template_file = @file_get_contents($tpl_file_out); } else { $template_file = @file_get_contents($tpl_file_in); $template_file = html_compress($template_file); $fp = @fopen ($tpl_file_out, 'w+') OR die (sumo_get_message('XXXXXX', $tpl_file_in)); @fwrite ($fp, $template_file); @fclose ($fp); } */ } preg_match_all('/{{.[\\/_\\-:a-z0-9.]+}}/i', $template_file, $match); $e_tpl_new = $element = array(); foreach ($match[0] as $element) { $e_tpl_new[] = str_replace('{{', '', str_replace('}}', '', $element)); } $num_e_tpl_new = count($e_tpl_new); for ($el = 0; $el < $num_e_tpl_new; $el++) { // standard template if (array_key_exists($e_tpl_new[$el], $assign)) { $str_new = str_replace('{{' . $e_tpl_new[$el] . '}}', $assign[$e_tpl_new[$el]], $template_file); $template_file = $str_new; } elseif (substr($e_tpl_new[$el], 0, 5) == 'LANG:') { $str_new = str_replace('{{' . $e_tpl_new[$el] . '}}', $language[str_replace("LANG:", "", $e_tpl_new[$el])], $template_file); $template_file = $str_new; } elseif (substr($e_tpl_new[$el], 0, 4) == 'TIP:') { if ($SUMO['config']['console']['tip']) { $help = str_replace("'", "’", $language[str_replace("TIP:", "", $e_tpl_new[$el])]); $help = str_replace('"', """, $help); $help = sumo_process_template($help, $assign); $id = sumo_get_simple_rand_string(); $tip = "<img src=\"themes/" . $theme . "/images/helptip.png\" id='" . $id . "' " . "width='11' height='11' style='cursor:pointer;' " . "onmouseout=\"UnTip();opacity('" . $id . "', 100, 50, 50)\" " . "onmouseover=\"Tip('" . $help . "',DELAY,50,WIDTH,200,SHADOW,true,FADEIN,200,FADEOUT,200," . "BORDERCOLOR,'#FFFF99',SHADOWCOLOR,'#947C52',FONTCOLOR,'#000000',BGCOLOR,'#FFFF99'," . "OPACITY,80,SHADOWWIDTH,3);opacity('" . $id . "', 50, 100, 50)\">" . "<script>opacity('" . $id . "', 100, 50, 1);</script>"; $str_new = str_replace('{{' . $e_tpl_new[$el] . '}}', $tip, $template_file); } else { $str_new = str_replace('{{' . $e_tpl_new[$el] . '}}', '', $template_file); } $template_file = $str_new; } elseif (substr($e_tpl_new[$el], 0, 5) == 'FILE:') { $name = pathinfo(str_replace('FILE:', '', $e_tpl_new[$el])); if ($name['dirname'] == '.') { $file = SUMO_PATH . "/themes/" . $theme . "/" . $name['dirname'] . "/" . $name['basename']; } else { $file = SUMO_PATH . $name['dirname'] . "/" . $name['basename']; } if (file_exists($file)) { $template_new = file_get_contents($file); $str_new = str_replace("{{" . $e_tpl_new[$el] . "}}", $template_new, $template_file); $str_new = sumo_process_template($str_new, $assign, $tpl_file, $theme); $template_file = $str_new; } else { $template_file = "FATAL ERROR: Template "" . $file . "" not found!"; } } } return $template_file; }