//////////////////////////////////////////////////////////////////////////////////// // FORGOT YOUR PASSWORD - SEND LINK if (isset($_POST['forgot'])) { if (isset($_POST['email']) && cl($_POST['email']) == $settings['SET_CONTACT']) { // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // More headers $headers .= 'From: ' . $settings['SET_CONTACT'] . "\r\n"; $subject = $settings['SET_TITLE'] . ' - ' . _T("admin_log_forgot_password_email_subject"); $find = array('{reset_url}', '{user_name}'); $reset_id = md5(time() . $settings['SET_SALTING']); $replace = array('reset_url' => '<a href="' . $settings['SET_SITEURL'] . 'admin.php?reset=' . $reset_id . '">' . $settings['SET_SITEURL'] . 'admin.php?reset=' . $reset_id . '</a>', 'user_name' => $settings['SET_USERNAME']); $msg = str_replace($find, $replace, _T("admin_log_forgot_password_email_body")); mail($settings['SET_CONTACT'], $subject, $msg, $headers); if (savefile(array('id' => $reset_id, 'date' => time()), CFDATAPATH . 'rs.cf')) { user_feedback('success', _T('admin_log_forgot_password_suc'), 'forgot_password'); $forgot_note = 1; } } else { user_feedback('error', _T("admin_log_forgot_password_email_err"), 'admin_log_forgot_password_email'); $forgot_note = 1; } } // FORGOT YOUR PASSWORD - RESET LINK CHECK if (isset($_GET['reset'])) { if (file_exists(CFDATAPATH . 'rs.cf')) { $reset_db = loadfile(CFDATAPATH . 'rs.cf'); if ($reset_db['id'] == cl($_GET['reset']) && $reset_db['date'] + 3600 > time()) { $reset_password = true; $_SESSION['reset_password'] = cl($_GET['reset']);
function updateContent($content_id, $arbre_id, $langue_id) { //recherche du contenu_id $requete_select_contenu = "select contenu_id,shortlib from " . __racinebd__ . "contenu c inner join " . __racinebd__ . "langue l on c.langue_id=l.langue_id where arbre_id = " . $arbre_id . " and l.langue_id!=" . $langue_id; $link_select_contenu = query($requete_select_contenu); $requete_select_content = "select * from " . __racinebd__ . "content where content_id = " . $content_id; $link_select_content = query($requete_select_content); $ligne_select_content = fetch($link_select_content); //print_r($_POST); //$result = mysql_query("select * from table"); $listfile = array(); while ($ligne_select_contenu = fetch($link_select_contenu)) { //$requete="insert into ".__racinebd__."content "; $listchamps = array(); $listvalue = array(); $listext = array(); //$listchamps[]="contenu_id"; //$listvalue[]=$ligne_select_contenu["contenu_id"]; for ($i = 0; $i < mysql_num_fields($link_select_content); $i++) { if (mysql_field_name($link_select_content, $i) != "content_id" && mysql_field_name($link_select_content, $i) != "contenu_id") { $champs = mysql_field_name($link_select_content, $i); if (strpos($champs, "ext") === false) { if ($_POST[$champs . "___" . $ligne_select_contenu["shortlib"]] != "") { $value = "'" . addslashes($_POST[$champs . "___" . $ligne_select_contenu["shortlib"]]) . "'"; } else { $value = "'" . addslashes($ligne_select_content[$champs]) . "'"; } $listchamps[] = $champs . "=" . $value; } else { //print $champs."___".$ligne_select_contenu["shortlib"]." : ".$_FILES[$champs."___".$ligne_select_contenu["shortlib"]]; //print_r($_FILES); if (isset($_FILES[$champs . "___" . $ligne_select_contenu["shortlib"]])) { //$numext=explode("___",$champs); //sauvegarde du fichier /* if(strlen($numext[0])>3){ $numext=substr($numext[0],-1); */ //print "ici"; if (strlen($champs) > 3) { $numext = substr($champs, -1); //print $numext; $listfile[] = array($champs . "___" . $ligne_select_contenu["shortlib"], __racinebd__ . "content" . $numext . "_"); } else { $listfile[] = array($champs . "___" . $ligne_select_contenu["shortlib"], __racinebd__ . "content"); } //$value=($_POST[$champs."___".$ligne_select_contenu["shortlib"]]=="")?"null":"'".$_POST[$champs."___".$ligne_select_contenu["shortlib"]]."'"; $value = $_FILES[$champs . "___" . $ligne_select_contenu["shortlib"]]["name"] != "" ? "'" . getext($_FILES[$champs . "___" . $ligne_select_contenu["shortlib"]]["name"]) . "'" : "null"; } else { $value = $ligne_select_content[$champs] == "" ? "null" : "'" . $ligne_select_content[$champs] . "'"; $listext[] = $champs; } if ($_POST[$champs . "___" . $ligne_select_contenu["shortlib"] . "_chk"] == 1) { $listchamps[] = $champs . "=null"; } else { if ($value != "null") { $listchamps[] = $champs . "=" . $value; } } } } } $requete_update_content = "update " . __racinebd__ . "content set " . implode(",", $listchamps) . " where contenu_id=" . $ligne_select_contenu["contenu_id"]; //print $requete_insert_content; //echo $requete_insert_content; $link = query($requete_update_content); //verification que la mise ajour a été effectué sinon on crée un enregistrement $sql = "select * from " . __racinebd__ . "content where contenu_id=" . $ligne_select_contenu["contenu_id"]; $link = query($sql); if (num_rows($link) == 0) { copyContent($content_id, $arbre_id, $langue_id, $ligne_select_contenu["langue_id"]); } else { $tbl = fetch($link); /* print_r($listfile); print_r($listext); */ //sauvegarde des fichiers différents for ($j = 0; $j < count($listfile); $j++) { savefile($listfile[$j][0], $listfile[$j][1], $tbl["content_id"]); } $dernier_ajout_content = $tbl["content_id"]; //a faire pour l'update //print_r($listext); for ($listextindice = 0; $listextindice < count($listext); $listextindice++) { $suffixe = strlen($listext[$listextindice]) > 3 ? substr($listext[$listextindice], -1) . "_" : ""; //$suffixe=($listextindice==0)?"":($listextindice+1)."_"; //print $_SERVER["DOCUMENT_ROOT"].__uploaddir__.__racinebd__.'content'.$suffixe.$ligne_select_content['content_id'].'.'.$ligne_select_content[$listext[$listextindice]]."<br>"; @copy($_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . __racinebd__ . 'content' . $suffixe . $ligne_select_content['content_id'] . '.' . $ligne_select_content[$listext[$listextindice]], $_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . __racinebd__ . 'content' . $suffixe . $dernier_ajout_content . '.' . $ligne_select_content[$listext[$listextindice]]); @copy($_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . 'tbl_' . __racinebd__ . 'content' . $suffixe . $ligne_select_content['content_id'] . '.' . $ligne_select_content[$listext[$listextindice]], $_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . 'tbl_' . __racinebd__ . 'content' . $suffixe . $dernier_ajout_content . '.' . $ligne_select_content[$listext[$listextindice]]); for ($i = 0; $i < 5; $i++) { @copy($_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . 'tbl_' . $i . __racinebd__ . 'content' . $suffixe . $ligne_select_content['content_id'] . '.' . $ligne_select_content[$listext[$listextindice]], $_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . 'tbl_' . $i . __racinebd__ . 'content' . $suffixe . $dernier_ajout_content . '.' . $ligne_select_content[$listext[$listextindice]]); } } $requete_select_fichier = "select * from " . __racinebd__ . "fichiers where content_id = " . $ligne_select_content['content_id'] . " and supprimer=0"; $link_select_fichier = query($requete_select_fichier); while ($ligne_select_fichier = fetch($link_select_fichier)) { $requete_insert_fichier = "insert into " . __racinebd__ . "fichiers (content_id,titre,abstract,ext,nom_fichier,supprimer,contenu) values (\r\n " . $dernier_ajout_content . ",\r\n '" . addslashes($ligne_select_fichier['titre']) . "',\r\n '" . addslashes($ligne_select_fichier['abstract']) . "',\r\n " . ($ligne_select_fichier['ext'] == "" ? "null" : "'" . $ligne_select_fichier['ext'] . "'") . ",\r\n '" . addslashes($ligne_select_fichier['nom_fichier']) . "',\r\n " . $ligne_select_fichier['supprimer'] . ",\r\n '" . addslashes($ligne_select_fichier['contenu']) . "'\r\n )"; $link_insert_fichier = query($requete_insert_fichier); $dernier_ajout_fichier = insert_id(); copy($_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . __racinebd__ . 'fichiers' . $ligne_select_fichier['fichiers_id'] . '.' . $ligne_select_fichier['ext'], $_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . __racinebd__ . 'fichiers' . $dernier_ajout_fichier . '.' . $ligne_select_fichier['ext']); } } } }
function edit_file($dir, $item) { // edit file global $mainframe, $mosConfig_live_site; if (($GLOBALS["permissions"] & 01) != 01) { show_error($GLOBALS["error_msg"]["accessfunc"]); } $fname = get_abs_item($dir, $item); if (!get_is_file($fname)) { show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]); } if (!get_show_item($dir, $item)) { show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]); } if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") { // Save / Save As $item = basename(stripslashes($GLOBALS['__POST']["fname"])); $fname2 = get_abs_item($dir, $item); if (!isset($item) || $item == "") { show_error($GLOBALS["error_msg"]["miscnoname"]); } if ($fname != $fname2 && @$GLOBALS['jx_File']->file_exists($fname2)) { show_error($item . ": " . $GLOBALS["error_msg"]["itemdoesexist"]); } savefile($fname2); $fname = $fname2; if (!empty($GLOBALS['__POST']['return_to'])) { $return_to = urldecode($GLOBALS['__POST']['return_to']); mosRedirect($return_to); } elseif (!empty($GLOBALS['__POST']['return_to_dir'])) { mosRedirect($_SERVER['PHP_SELF'] . '?option=com_joomlaxplorer&dir=' . $dir, 'The File ' . $item . ' was saved.'); } } // header $s_item = get_rel_item($dir, $item); if (strlen($s_item) > 50) { $s_item = "..." . substr($s_item, -47); } show_header($GLOBALS["messages"]["actedit"] . ": /" . $s_item); $s_info = pathinfo($s_item); $s_extension = str_replace('.', '', $s_info['extension']); switch (strtolower($s_extension)) { case 'txt': $cp_lang = 'text'; break; case 'cs': $cp_lang = 'csharp'; break; case 'css': $cp_lang = 'css'; break; case 'html': case 'htm': case 'xml': case 'xhtml': $cp_lang = 'html'; break; case 'java': $cp_lang = 'java'; break; case 'js': $cp_lang = 'javascript'; break; case 'pl': $cp_lang = 'perl'; break; case 'ruby': $cp_lang = 'ruby'; break; case 'sql': $cp_lang = 'sql'; break; case 'vb': case 'vbs': $cp_lang = 'vbscript'; break; case 'php': $cp_lang = 'php'; break; default: $cp_lang = 'generic'; } // Form echo '<script type="text/javascript" src="components/com_joomlaxplorer/scripts/codepress/codepress.js"></script>'; echo "<br/><form name=\"editfrm\" id=\"editfrm\" method=\"post\" action=\"" . make_link("edit", $dir, $item) . "\">\n"; if (!empty($GLOBALS['__GET']['return_to'])) { $close_action = 'window.location=\'' . urldecode($GLOBALS['__GET']['return_to']) . '\';'; echo "<input type=\"hidden\" name=\"return_to\" value=\"" . $GLOBALS['__GET']['return_to'] . "\" />\n"; } else { $close_action = 'window.location=\'' . make_link('list', $dir, NULL) . "'"; } $submit_action = 'document.editfrm.code.value=codearea.getCode();document.editfrm.submit();'; echo "\r\n<table class=\"adminform\">\r\n\t<tr>\r\n\t\t<td style=\"text-align: center;\">\r\n\t\t\t<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnsave"] . "\" onclick=\"{$submit_action}\" /> \r\n\t\t\t<input type=\"reset\" value=\"" . $GLOBALS["messages"]["btnreset"] . "\" /> \r\n\t\t\t<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnclose"] . "\" onclick=\"javascript:{$close_action}\" />\r\n\t\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td >\r\n\t\t\t<div id=\"positionIndicator\" style=\"width: 20%;float:left;\">" . $GLOBALS["messages"]["line"] . ": <input type=\"text\" name=\"txtLine\" class=\"inputbox\" size=\"6\" onchange=\"setCaretPosition(document.editfrm.code, this.value);return false;\" /> " . $GLOBALS["messages"]["column"] . ": <input type=\"text\" name=\"txtColumn\" class=\"inputbox\" size=\"6\" readonly=\"readonly\" />\r\n </div>\r\n\t\t\t<div style=\"width:70%;text-align: center;float:left;\">\r\n\t\t\t\t<input type=\"checkbox\" value=\"1\" name=\"return_to_dir\" id=\"return_to_dir\" />\r\n\t\t\t\t<label for=\"return_to_dir\">" . $GLOBALS["messages"]["returndir"] . "</label>\r\n\t\t\t</div>"; echo "\r\n\t\t</td>\r\n\t</tr>\r\n\t<tr><td>"; echo "<input type=\"hidden\" name=\"dosave\" value=\"yes\" />\n"; // Show File In TextArea $content = $GLOBALS['jx_File']->file_get_contents($fname); if (get_magic_quotes_runtime()) { $content = stripslashes($content); } $content = htmlspecialchars($content); echo '[<a href="javascript:;" onclick="positionIndicator.toggle(); codearea.toggleEditor();return false;">' . $GLOBALS['messages']['editor_simple'] . ' / ' . $GLOBALS['messages']['editor_syntaxhighlight'] . '</a>]'; echo '<div id="editorarea"> <textarea class="codepress ' . $cp_lang . '" style="width:95%;" name="codearea" id="codearea" rows="25" cols="120" wrap="off" onmouseup="updatePosition(this)" onmousedown="updatePosition(this)" onkeyup="updatePosition(this)" onkeydown="updatePosition(this)" onfocus="updatePosition(this)">' . $content . '</textarea> <input type="hidden" name="code" value="" /> </div><br/>'; echo "\r\n\t</td>\r\n\t</tr>"; echo "\r\n\t<tr>\r\n\t\t<td align=\"right\">\r\n\t\t\t<label for=\"fname\">" . $GLOBALS["messages"]["copyfile"] . "</label>\r\n\t\t\t<input type=\"text\" name=\"fname\" value=\"" . $item . "\" size=\"40\" />\r\n\t\t</td>\r\n\t</tr>\r\n</table>\r\n<br/>"; echo "\r\n</form>\r\n<br/>\n"; ?> <script type="text/javascript"> <!-- if(document.editfrm && document.editfrm.code) document.editfrm.code.focus(); positionIndicator = new Fx.Slide( 'positionIndicator' ).hide(); //http://www.bazon.net/mishoo/home.epl?NEWS_ID=1345 function doGetCaretPosition (textarea) { var txt = textarea.value; var len = txt.length; var erg = txt.split("\n"); var pos = -1; if(typeof textarea.selectionStart != "undefined") { // FOR MOZILLA pos = textarea.selectionStart; } else if(typeof document.selection != "undefined") { // FOR MSIE range_sel = document.selection.createRange(); range_obj = textarea.createTextRange(); range_obj.moveToBookmark(range_sel.getBookmark()); range_obj.moveEnd('character',textarea.value.length); pos = len - range_obj.text.length; } if(pos != -1) { var ind = 0; for(;erg.length;ind++) { len = erg[ind].length + 1; if(pos < len) break; pos -= len; } ind++; pos++; return [ind, pos]; // ind = LINE, pos = COLUMN } } /** * This function allows us to change the position of the caret * (cursor) in the textarea * Various workarounds for IE, Firefox and Opera are included * Firefox doesn't count empty lines, IE does... */ function setCaretPosition( textarea, linenum ) { if (isNaN(linenum)) { updatePosition( textarea ); return; } var txt = textarea.value; var len = txt.length; var erg = txt.split("\n"); var ind = 0; var pos = 0; var nonempty = -1; var empty = -1; for(;ind < linenum;ind++) { /*alert( "Springe zu Zeile: "+linenum +"\naktuelle Zeile: "+ (ind+1) + "\naktuelle Position: "+pos + "\nText in dieser Zeile: "+erg[ind]);*/ if( !erg[ind] && pos < len ) { empty++; pos++; continue; } else if( !erg[ind] ) break; pos += erg[ind].length; nonempty++; } try { pos -= erg[ind-1].length; } catch(e) {} textarea.focus(); if(textarea.setSelectionRange) { pos += nonempty; textarea.setSelectionRange(pos,pos); } else if (textarea.createTextRange) { pos -= empty; var range = textarea.createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); } } /** * Updates the Position Indicator fields */ function updatePosition(textBox) { var posArray = doGetCaretPosition(textBox); document.forms[0].txtLine.value = posArray[0]; document.forms[0].txtColumn.value = posArray[1]; } // --> </script><?php }
function edit_file($dir, $item) { if (!permissions_grant($dir, $item, "change")) { show_error($GLOBALS["error_msg"]["accessfunc"]); } if (!get_is_file($dir, $item)) { show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]); } if (!get_show_item($dir, $item)) { show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]); } $fname = get_abs_item($dir, $item); if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") { // Save / Save As $item = basename(stripslashes($GLOBALS['__POST']["fname"])); $fname2 = get_abs_item($dir, $item); if (!isset($item) || $item == "") { show_error($GLOBALS["error_msg"]["miscnoname"]); } if ($fname != $fname2 && @file_exists($fname2)) { show_error($item . ": " . $GLOBALS["error_msg"]["itemdoesexist"]); } savefile($fname2); $fname = $fname2; } // open file $fp = @fopen($fname, "r"); if ($fp === false) { show_error($item . ": " . $GLOBALS["error_msg"]["openfile"]); } // header $s_item = get_rel_item($dir, $item); if (strlen($s_item) > 50) { $s_item = "..." . substr($s_item, -47); } show_header($GLOBALS["messages"]["actedit"] . ": /" . $s_item); // Wordwrap (works only in IE) ?> <script language="JavaScript1.2" type="text/javascript"> <!-- function chwrap() { if(document.editfrm.wrap.checked) { document.editfrm.code.wrap="soft"; } else { document.editfrm.code.wrap="off"; } } // --> </script> <script language="Javascript" type="text/javascript"> // initialisation editAreaLoader.init({ id: "txtedit" // id of the textarea to transform ,start_highlight: true // if start with highlight ,allow_resize: "both" //,min_width = 400 //,min_height = 100 //,allow_resize: "y" ,allow_toggle: true ,word_wrap: true ,language: "<?php echo $GLOBALS["language"]; ?> " ,syntax: "<?php echo get_mime_type($dir, $item, "ext"); ?> " }); </script> <?php // Form echo "<BR><FORM name=\"editfrm\" method=\"post\" action=\"" . make_link("edit", $dir, $item) . "\">\n"; echo "<input type=\"hidden\" name=\"dosave\" value=\"yes\">\n"; echo "<TEXTAREA NAME=\"code\" ID=\"txtedit\" rows=\"25\" cols=\"120\" wrap=\"off\">"; // Show File In TextArea $buffer = ""; while (!feof($fp)) { $buffer .= fgets($fp, 4096); } @fclose($fp); //echo htmlspecialchars($buffer); echo $buffer; echo "</TEXTAREA><BR>\n<TABLE><TR><TD>Wordwrap: (IE only)</TD><TD><INPUT type=\"checkbox\" name=\"wrap\" "; echo "onClick=\"javascript:chwrap();\" value=\"1\"></TD></TR></TABLE><BR>\n"; echo "<TABLE><TR><TD><INPUT type=\"text\" name=\"fname\" value=\"" . $item . "\"></TD>"; echo "<TD><input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnsave"]; echo "\"></TD>\n<TD><input type=\"reset\" value=\"" . $GLOBALS["messages"]["btnreset"] . "\"></TD>\n<TD>"; echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnclose"] . "\" onClick=\"javascript:location='"; echo make_link("list", $dir, NULL) . "';\"></TD></TR></FORM></TABLE><BR>\n"; ?> <script language="JavaScript1.2" type="text/javascript"> <!-- if(document.editfrm) document.editfrm.code.focus(); // --> </script><?php }
<?php require "../../require/function.php"; require "../../require/back_include.php"; $_GET["nomobj"] = "listmontant[]"; set_time_limit(3600); $sql = "select * from " . __racinebd__ . "newsletterline where newsletterline_id=" . ($_GET["id"] == "" ? $_POST["newsletterline_id"] : $_GET["id"]); $link = query($sql); $tbl_info = fetch($link); if ($_POST["save"] == "yes") { if ($_FILES["ext"]["tmp_name"] != "") { $myext = savefile("ext", __racinebd__ . "newsletterline", $_POST["newsletterline_id"]); $myext = ",ext='" . getext($_FILES["ext"]["name"]) . "'"; } //sauvegarde en base $sql = "update " . __racinebd__ . "newsletterline \r\n set titre='" . addquote($_POST["titre"]) . "',\r\n contenu='" . str_replace(",", ".", addquote($_POST["contenu"])) . "',\r\n lien='" . str_replace(",", ".", addquote($_POST["lien"])) . "'\r\n {$myext}\r\n where newsletterline_id=" . $_POST["newsletterline_id"]; $link = query($sql); ?> <script> alert("Modifications prises en compte"); if(top.listidmontantiframelist.contentWindow) top.listidmontantiframelist.contentWindow.location.href=top.listidmontantiframelist.contentWindow.location.href.replace('mode=',''); else top.listidmontantiframelist.location.href=top.listidmontantiframelist.location.href.replace('mode=',''); window.location="insertfile.php?nomobj=listontant[]&id=<?php echo $tbl_info["newsletter_id"]; ?> "; </script>
echo "res={ sabai: false, msg: 'OpenVPN file missing.' };"; break; } case "stop": $line = exec("sh /www/bin/ovpn.sh {$act} 2>&1", $out); $i = count($out) - 1; while (substr($line, 0, 3) != "res" && $i >= 0) { $line = $out[$i--]; } file_put_contents("/etc/sabai/stat/php.ovpn.log", implode("\n", $out)); echo $line; break; case "clear": exec("sh /www/bin/ovpn.sh clear 2>&1"); echo "res={ sabai: true, msg: 'OpenVPN file removed.', reload: true };"; break; case "newfile": newfile(); break; case "save": savefile(); break; case "log": exec("/www/bin/ovpn.sh log"); echo file_exists("/var/log/ovpn_web.log") ? str_replace(array("\"", "\r"), array("'", "\n"), file_get_contents("/var/log/ovpn_web.log")) : "No log."; break; case "check": $line = exec("sh /www/bin/ovpn.sh {$act}"); echo $line; break; }
function uploadfile($field, $intro = "", $SaveDir = "", $SaveFileName = "", $type = "upload") { global $iCMS; $UploadDir = $iCMS->config['uploadfiledir'] . "/"; $RelativePath = $iCMS->dir . $UploadDir; //相对路径 $RootPath = iPATH . $UploadDir; //绝对路径 if ($_FILES[$field]['name']) { $tmp_name = $_FILES[$field]['tmp_name']; !is_uploaded_file($tmp_name) && exit("What are you doing?"); if ($_FILES[$field]['error'] > 0) { switch ((int) $_FILES[$field]['error']) { case UPLOAD_ERR_NO_FILE: @unlink($tmp_name); alert('请选择上传文件!'); return false; break; case UPLOAD_ERR_FORM_SIZE: @unlink($tmp_name); alert('上传的文件超过大小!'); return false; break; } return false; } $_FileSize = @filesize($tmp_name); //文件类型 preg_match("/\\.([a-zA-Z0-9]{2,4})\$/", $_FILES[$field]['name'], $exts); $FileExt = strtolower($exts[1]); //ļʽ CheckValidExt($FileExt); //判断文件类型 //过滤文件; strstr($FileExt, 'ph') && ($FileExt = "phpfile"); in_array($FileExt, array('cer', 'htr', 'cdx', 'asa', 'asp', 'jsp', 'aspx', 'cgi')) && ($FileExt .= "file"); $FileNameTmp = get_date('', "YmdHis") . rand(1, 999999); empty($SaveFileName) && ($SaveFileName = $FileNameTmp . "." . $FileExt); $oFileName = $_FILES[$field]['name']; // 文件保存目录方式 $_CreateDir = ""; if (empty($SaveDir)) { if ($iCMS->config['savedir']) { $_CreateDir = str_replace(array('Y', 'y', 'm', 'n', 'd', 'j', 'EXT'), array(get_date('', 'Y'), get_date('', 'y'), get_date('', 'm'), get_date('', 'n'), get_date('', 'd'), get_date('', 'j'), $FileExt), $iCMS->config['savedir']) . "/"; } } else { $_CreateDir = $SaveDir . "/"; } // $UploadDir = $UploadDir.$_CreateDir; $RelativePath = $RelativePath . $_CreateDir; $RootPath = $RootPath . $_CreateDir; //创建目录 createdir($RootPath); //文件名 // $sFileName = $UploadDir.$SaveFileName; $RelativePath_FileName = $RelativePath . $SaveFileName; $RootPath_FileName = $RootPath . $SaveFileName; savefile($tmp_name, $RootPath_FileName); if (in_array($FileExt, array('gif', 'jpg', 'jpeg', 'png'))) { if ($iCMS->config['isthumb'] && ($iCMS->config['thumbwidth'] || $iCMS->config['thumbhight'])) { $Thumb = MakeThumbnail($RootPath, $RootPath_FileName, $FileNameTmp); !empty($Thumb['src']) && imageWaterMark($Thumb['src']); } imageWaterMark($RootPath . $SaveFileName); } $RelativePath_FileName = getfilepath($RelativePath_FileName, '', '-'); // 写入数据库 if ($type == "upload") { $iCMS->db->query("INSERT INTO `#iCMS@__file` (`filename`,`ofilename`,`path`,`intro`,`ext`,`size`,`time`,`type`) VALUES ('{$SaveFileName}', '{$oFileName}', '{$RelativePath_FileName}','{$intro}', '{$FileExt}', '{$_FileSize}', '" . time() . "', 'upload') "); } $_File = array('fid' => $iCMS->db->insert_id, 'FilePath' => $RelativePath_FileName, 'OriginalFileName' => $oFileName, 'FileName' => $SaveFileName); return $_File; } else { return; } }
function dosomething($bestand, $host, $actie) { if (!empty($bestand) && !empty($host) && !empty($actie)) { # this function should be called per item on a foreach loop. switch ($actie) { case 'shortstat': savefile($host, $bestand); $parsed_host = parse_url($host, PHP_URL_HOST); shortstat($bestand, $parsed_host); break; case 'historystat': echo "<table>"; savefile($host, $bestand); $parsed_host = parse_url($host, PHP_URL_HOST); historystat($bestand, $parsed_host); echo "</table>"; break; } } }
<?php require "avssinit.php"; if (!$authstatus) { echo "not logged in"; exit; } savefile($path, $file);
if ($_FILES["ext"]["tmp_name"] != "") { $myext = savefile("ext", $table, $id); tbl_img($table, $id, getext($_FILES["ext"]["name"]), 16, 10); } //mise a niveau de la table contenu, pour les traduction des noeuds $sql = "select * from " . __racinebd__ . "contenu where langue_id=" . __defaultlangueid__; $link = query($sql); while ($tbl_result = fetch($link)) { $sql = "insert into " . __racinebd__ . "contenu (arbre_id,langue_id,nom,translate) values (" . $tbl_result["arbre_id"] . "," . $id . ",'" . $tbl_result["nom"] . "',0)"; query($sql); } $szQuery = ""; break; case "modif": if ($_FILES["ext"]["tmp_name"] != "" && $_POST["ext_chk"] != 1) { $myext = savefile("ext", $table); tbl_img($table, $_GET["id"], getext($_FILES["ext"]["name"]), 16, 10); } else { if ($_POST["ext_chk"] == 1) { $myext = ",ext=null "; } } $txtmsg = "La langue a été modifiée"; $szQuery = "update {$table} set \r\n\t\t\t\t\tlibelle='" . addquote($_POST["libelle"]) . "',\r\n\t\t\t\t\tshortlib='" . addquote($_POST["shortlib"]) . "',\r\n\t\t\t\t\tactive='" . addquote($_POST["active"]) . "'\r\n\t\t\t\t\t{$myext}\r\n where {$tablekey}=" . $_GET["id"]; break; } require "../../include/template_save.php"; } else { $szQuery = "SELECT * FROM {$table} where {$tablekey}=" . $_GET["id"]; //libelle=>nom du champ|type|obligatoire|taille (facultatif) //les type sont les suivant
$link = query($sql); $tbl = fetch($link); if ($_FILES["ext"]["tmp_name"] != "") { $myext = "'" . getext($_FILES["ext"]["name"]) . "'"; } else { if ($_POST["ext"] != "") { $myext = "'" . $_POST["ext"] . "'"; } else { $myext = "null"; } } $sql = "insert into " . __racinebd__ . "newsletterline (newsletter_id,titre,contenu,ordre,ext,lien) \r\n value('" . addquote($_GET["id"]) . "','" . addquote($_POST["titre"]) . "','" . str_replace(",", ".", addquote($_POST["contenu"])) . "','" . ($tbl["maxordre"] + 1) . "',{$myext},'" . addquote($_POST["lien"]) . "')"; $link = query($sql); $mmontant_id = insert_id(); if ($_FILES["ext"]["tmp_name"] != "") { savefile("ext", __racinebd__ . "newsletterline", $mmontant_id); } ?> <script> //rafraichissement de la liste //alert(top.listidmontantiframelist.location) if(top.listidmontantiframelist.contentWindow) top.listidmontantiframelist.contentWindow.location.href=top.listidmontantiframelist.contentWindow.location.href.replace('mode=',''); else top.listidmontantiframelist.location.href=top.listidmontantiframelist.location.href.replace('mode=',''); </script> <?php } ?> <html>
$sql_zcard = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.cardvalue) as revenue_gross,SUM(t1.cardvalue) as revenue_net FROM {$table_zcard} t1 WHERE t1.verify = '1' AND t1.gameID = '{$gameID}' "; $row_zcard = runSQL($sql_zcard); $sql_mcard = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.grossAmount) as revenue_gross,SUM(t1.netAmount) as revenue_net FROM {$table_mcard} t1 WHERE t1.groupResponseCode = '1' AND t1.gameID = '{$gameID}' "; $row_mcard = runSQL($sql_mcard); $sql_sms = "SELECT COUNT(t1.requestid) as qty,SUM(t1.money) as revenue_gross,SUM(t1.net_money) as revenue_net FROM {$table_sms} t1 \n "; $row_sms = runSQL_sms($sql_sms, $database_name); $list['atm'] = $row_atm; $list['zcard'] = $row_zcard; $list['mcard'] = $row_mcard; $list['sms'] = $row_sms; // $result = json_encode($list); // savefile($result, $name_file_log); return $list; } // $min = $argv[1]; $time = time() - 86400; $name_file_log = date("Ymd", $time); $date_to = date("Y-m-d", $time); $game_id = array("FH", "SGMB", "FARM", "MPCOTUONG", "CARO", "MPPOKER", "MPTALA", "MPBINH", "MPTIENLEN", "MPXITO", "ZINZIN", "THOILOAN", "LM", "10HA7", "CANDYRUN", "VLMB", "ZB", "CUUTOC", "FARMWEB", "WC2014", "ICA"); $re = array(); foreach ($game_id as $value) { $re[$value] = getRevenue($date_to, $value); } $re = json_encode($re); savefile($re, $name_file_log); die; // for ($i = 1; $i <= 30; $i++) { // $date_to = "2015-06-" . sprintf("%02d", $i); // $name_file_log = "201506" . sprintf("%02d", $i); ; // getRevenue($date_to,$name_file_log); // }
//creation du repertoire tmp //@mkdir ($_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id'], 0775); //deplacement du fichier //move_uploaded_file($_FILES[ext]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$_FILES["ext"]["name"]); //$filename=preg_replace('/[^a-z0-9_\-\.]/i', '_', $_FILES["ext"]["name"]); $filename = preg_replace('/[^a-z0-9_\\-\\.]/i', '_', $_FILES["ext"]["name"]); $filename = makename($_FILES["ext"]["name"]); //if(move_uploaded_file($_FILES["ext"]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$filename)===false){ //sauvegarde en base $ext = getext($_FILES["ext"]["name"]); //$sql="insert into ".__racinebd__."fichiers (titre,abstract,ext,nom_fichier,contenu) value('".addquote($_POST["titre_fichier"])."','".addquote($_POST["description_fichier"])."','".$ext."','".$filename."','".$contenu."')"; $sql = "insert into " . __racinebd__ . "fichiers (titre,abstract,ext,nom_fichier) value('" . addquote($_POST["titre_fichier"]) . "','" . addquote($_POST["description_fichier"]) . "','" . $ext . "','" . addquote($filename) . "')"; //print $sql; $link = query($sql); $fichiers_id = insert_id(); savefile("ext", __racinebd__ . "fichiers", $fichiers_id); //print $_SERVER["DOCUMENT_ROOT"].__uploaddir__.__racinebd__."fichiers".$fichiers_id.".".$ext; if (PHANTOM_FULLTEXT == true) { $contenu = addslashes(extract2tmpfile($ext, $_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . __racinebd__ . "fichiers" . $fichiers_id . "." . $ext)); } if ($contenu == '') { $contenu = addquote($_POST["description_fichier"]); } $sql = "update " . __racinebd__ . "fichiers set contenu='" . $contenu . "' where fichiers_id=" . $fichiers_id; query($sql); ?> <script> content='<table width="100%" style="border-bottom:1px solid black" id="table_fichier_<?php echo $fichiers_id; ?> ">';
$myext2 = savefile("iconsecure", $table . "2_", $id); tbl_img($table . "2_", $id, getext($_FILES["iconsecure"]["name"]), 18, 18); } $szQuery = ""; break; case "modif": if ($_FILES["iconnormal"]["tmp_name"] != "" && $_POST["iconnormal_chk"] != 1) { $myext = savefile("iconnormal", $table); tbl_img($table, $_GET["id"], getext($_FILES["iconnormal"]["name"]), 18, 18); } else { if ($_POST["iconnormal_chk"] == 1) { $myext = ",iconnormal=null "; } } if ($_FILES["iconsecure"]["tmp_name"] != "" && $_POST["iconsecure_chk"] != 1) { $myext2 = savefile("iconsecure", $table . "2_"); tbl_img($table . "2_", $_GET["id"], getext($_FILES["iconsecure"]["name"]), 18, 18); } else { if ($_POST["iconsecure_chk"] == 1) { $myext2 = ",iconsecure=null "; } } $txtmsg = $trad["Le gabarit a été modifié"]; $szQuery = "update {$table} set \r\n\t\t\t\t\tlibelle='" . addquote($_POST["libelle"]) . "',\r\n\t\t\t\t\ttable_nom='" . addquote($_POST["table_nom"]) . "',\r\n\t\t\t\t\tnom_fichier='" . addquote($_POST["nom_fichier"]) . "',\r\n\t\t\t\t\tsitemap='" . addquote($_POST["sitemap"]) . "',\r\n\t\t\t\t\tsearch='" . addquote($_POST["search"]) . "',\r\n\t\t\t\t\trss='" . addquote($_POST["rss"]) . "'\r\n\t\t\t\t\t{$myext}\r\n\t\t\t\t\t{$myext2} \r\n where {$tablekey}=" . $_GET["id"]; break; } require "../../include/template_save.php"; } else { $szQuery = "SELECT * FROM {$table} where {$tablekey}=" . $_GET["id"]; //libelle=>nom du champ|type|obligatoire|taille (facultatif) //les type sont les suivant
/** * autoDeleted() * Automatic remove images if they have not be viewed for some time */ function autoDeleted() { global $settings; // check auto remove image is on if (!check_set('SET_AUTO_DELETED')) { return; } // make file name $checkfor = CFDATAPATH . 'ad' . date($settings['SET_AUTO_DELETED_JUMP']); // check to see if it's been run for this time period if (is_file($checkfor)) { return; } // get image index $db_img = imageList(0, 'all'); // check image index for images if (empty($db_img) || count($db_img) < 1) { return; } $delete_time = time() - $settings['SET_AUTO_DELETED_TIME'] * 86400; // check when image was last viewed foreach ($db_img as $k => $image) { // check to see if the image has been uploaded for long then the period if ($delete_time > $image['added']) { // image viewed db address $img_view_db = CFBANDWIDTHPATH . $image['id'] . '_imgbw.db'; // check to see if there is a images viewed db file if (is_file($img_view_db)) { // read files last modified date (as this is most likely the last viewed date) if ($last_modified = filemtime($img_view_db)) { // check to see if it has not been view for the period if ($delete_time > $last_modified) { $delete_id[$image['id']] = array('deleteid' => $image['deleteid']); // add image to remove array } } else { $db_count = db_imageCounterList(null, $image['id']); if (isset($db_count['date'])) { if ($delete_time > $db_count['date']) { $delete_id[$image['id']] = array('deleteid' => $image['deleteid']); // add image to remove array } } } } else { $delete_id[$image['id']] = array('deleteid' => $image['deleteid']); // add image to remove array } } } //remove images if (!empty($delete_id)) { foreach ($delete_id as $k => $image) { removeImage($image['deleteid']); } } // remove image removed meg $Suc = array(); // make lasted checked file if (savefile(array(), CFDATAPATH . 'ad' . date($settings['SET_AUTO_DELETED_JUMP']))) { // check for old file if (is_file(CFDATAPATH . 'ad' . (date($settings['SET_AUTO_DELETED_JUMP']) - 1))) { // remove old file if found @unlink(CFDATAPATH . 'ad' . (date($settings['SET_AUTO_DELETED_JUMP']) - 1)); } } }
<?php $college = array(0 => '文学院', 1 => '外国语学院', 2 => '历史文化学院', 3 => '马克思主义学院', 4 => '法学院', 5 => '教育科学学院', 6 => '教师教育学院', 7 => '商学院', 8 => '数学与统计科学学院', 9 => '物理与光电工程学院', 10 => '化学与材料科学学院', 11 => '生命科学学院', 12 => '地理与规划学院', 13 => '交通学院', 14 => '土木工程学院', 15 => '信息与电气工程学院', 16 => '食品工程学院', 17 => '农学院', 18 => '艺术学院', 19 => '体育学院', 20 => '国际教育学院', 21 => '蔚山船舶与海洋学院', 22 => '大学外语教学部', 23 => '中国思想文化研究院', 24 => '环渤海发展研究院', 25 => '菌物科学与技术研究院', 26 => '胶东文化研究院'); $total_college = count($college); $host_sae = 'http://facecollege-o.stor.sinaapp.com/uploads/'; if (empty($_FILES['face'])) { echo 'Welcome to <a href="http://sailboat.ldustu.com">LDSN</a> .'; return; } else { $filename = $_FILES['face']['name']; $tmp_name = $_FILES['face']['tmp_name']; $tmp_file_name_arr = explode('.', $filename); $new_file_name = $tmp_file_name_arr[0] . '_' . time() . '.' . $tmp_file_name_arr[1]; if (file_exists($_FILES['face']['tmp_name'])) { savefile($tmp_name, $new_file_name); } else { $result = array('status' => -1, 'msg' => '上传图片失败'); echo json_encode($result); return; } $url = $host_sae . $new_file_name; $result = array('status' => 1, 'msg' => 'ok', 'info' => array('url' => $url)); $r = detect($url); if ($r['status'] == 1) { if (empty($r['output']['face'])) { delfile($new_file_name); $result = array('status' => -2, 'msg' => '上传的图片没有脸呀,亲'); echo json_encode($result); return; } $college_id = charge($r['output']);
} } } if ($_FILES["ext4"]["tmp_name"] != "" && $_POST["ext4_chk"] != 1) { $myext4 = savefile("ext4", $table . "4_"); } else { if ($_POST["ext4"] != "" && $_POST["ext4_chk"] != 1) { $myext4 = ",ext4='" . $_POST["ext4"] . "'"; } else { if ($_POST["ext4_chk"] == 1) { $myext4 = ",ext4=null"; } } } if ($_FILES["ext5"]["tmp_name"] != "" && $_POST["ext5_chk"] != 1) { $myext5 = savefile("ext5", $table . "5_"); } else { if ($_POST["ext5"] != "" && $_POST["ext5_chk"] != 1) { $myext5 = ",ext5='" . $_POST["ext5"] . "'"; } else { if ($_POST["ext5_chk"] == 1) { $myext5 = ",ext5=null"; } } } //si pas de changement d'etat $szQuery = "update {$table} set \r\n \t\t\t\t\ttitre1='" . addquote($_POST["titre1"]) . "',\r\n \t\t\t\t\ttitre2='" . addquote($_POST["titre2"]) . "',\r\n \t\t\t\t\ttitre3='" . addquote($_POST["titre3"]) . "',\r\n \t\t\t\t\ttitre4='" . addquote($_POST["titre4"]) . "',\r\n \t\t\t\t\ttitre5='" . addquote($_POST["titre5"]) . "',\r\n \t\t\t\t\tabstract='" . addquote($_POST["abstract"]) . "',\r\n abstract2='" . addquote($_POST["abstract2"]) . "',\r\n \t\t\t\t\tabstract3='" . addquote($_POST["abstract3"]) . "',\r\n \t\t\t\t\tabstract4='" . addquote($_POST["abstract4"]) . "',\r\n \t\t\t\t\tabstract5='" . addquote($_POST["abstract5"]) . "',\r\n \t\t\t\t\tcontenu='" . addquote($_POST["contenu"]) . "',\r\n \t\t\t\t\tdate_actu='" . datetimebdd($_POST["date_actu"]) . "',\r\n \t\t\t\t\tdate_fin='" . datetimebdd($_POST["date_fin"]) . "',\r\n \t\t\t\t\tnote='" . $_POST["note"] . "',\r\n \t\t\t\t\tversion_id='" . $_POST["version_id"] . "',\r\n \t\t\t\t\ttwitter='" . $_POST["twitter"] . "',\r\n \t\t\t\t\ttva_id='" . $_POST["tva_id"] . "',\r\n \t\t\t\t\tfournisseur_id='" . $_POST["fournisseur_id"] . "',\r\n note1='" . $_POST["note1"] . "',\r\n note2='" . $_POST["note2"] . "',\r\n note3='" . $_POST["note3"] . "',\r\n note4='" . $_POST["note4"] . "',\r\n archive='" . $_POST["archive"] . "',\r\n envoye='" . $_POST["envoye"] . "',\r\n titleseo='" . addquote($_POST["titleseo"]) . "',\r\n abstractseo='" . addquote($_POST["abstractseo"]) . "',\r\n robotseo='" . addquote($_POST["robotseo"]) . "'\r\n \t\t\t\t\t{$myext}\r\n \t\t\t\t\t{$myext2}\r\n \t\t\t\t\t{$myext3}\r\n \t\t\t\t\t{$myext4}\r\n {$myext5}\r\n where content_id=" . $content_id; majfichier($content_id); majval($content_id); updateContent($content_id, $_GET["arbre_id"], $_GET["langue_id"]); createdefault("ext", $table, $content_id);
header("Content-type: text/plain"); } else { $attach = $fi; header("Content-type: hackru"); } header("Content-disposition: attachment; filename=\"{$attach}\";"); readfile($tm . "/" . $fi); break; case "download_mail": download_mail($tm, $fi); break; case "edit": editfile($tm, $fi); break; case "save": savefile($tm, $fi); break; case "uploadd": uploadtem(); break; case "up": up($tm); break; case "newdir": newdir($tm); break; case "createdir": cdir($tm); break; case "deldir": deldir();
function getimg($filename) { $md5file = $this->dir . "/" . substr(md5($filename), 10, 10) . strrchr($filename, "."); if (file_exists($md5file)) { return $md5file; } //开始获取文件,并返回新路径 $img = file_get_contents($filename); if ($img) { if (!is_dir($this->dir)) { mkdir($this->dir); } savefile($md5file, $img); return $md5file; } }
function edit_file($dir, $item) { // edit file $mainframe =& JFactory::getApplication(); if (($GLOBALS["permissions"] & 01) != 01) { show_error($GLOBALS["error_msg"]["accessfunc"]); } $fname = get_abs_item($dir, $item); if (!get_is_file($fname)) { show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]); } if (!get_show_item($dir, $item)) { show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]); } if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") { // Save / Save As $item = basename(stripslashes($GLOBALS['__POST']["fname"])); $fname2 = get_abs_item($dir, $item); if (!isset($item) || $item == "") { show_error($GLOBALS["error_msg"]["miscnoname"]); } if ($fname != $fname2 && @$GLOBALS['nx_File']->file_exists($fname2)) { show_error($item . ": " . $GLOBALS["error_msg"]["itemdoesexist"]); } savefile($fname2); $fname = $fname2; if (!empty($GLOBALS['__POST']['return_to'])) { $return_to = urldecode($GLOBALS['__POST']['return_to']); $mainframe->redirect($return_to); } elseif (!empty($GLOBALS['__POST']['return_to_dir'])) { $mainframe->redirect($_SERVER['PHP_SELF'] . '?option=com_osefileman&dir=' . $dir, 'The File ' . $item . ' was saved.'); } } // header $s_item = get_rel_item($dir, $item); if (strlen($s_item) > 50) { $s_item = "..." . substr($s_item, -47); } show_header($GLOBALS["messages"]["actedit"] . ": /" . $s_item); $s_info = pathinfo($s_item); $s_extension = str_replace('.', '', $s_info['extension']); switch (strtolower($s_extension)) { case 'txt': case 'ini': $cp_lang = 'text'; break; case 'cs': $cp_lang = 'csharp'; break; case 'css': $cp_lang = 'css'; break; case 'html': case 'htm': case 'xml': case 'xhtml': $cp_lang = 'html'; break; case 'java': $cp_lang = 'java'; break; case 'js': $cp_lang = 'javascript'; break; case 'pl': $cp_lang = 'perl'; break; case 'ruby': $cp_lang = 'ruby'; break; case 'sql': $cp_lang = 'sql'; break; case 'vb': case 'vbs': $cp_lang = 'vbscript'; break; case 'php': $cp_lang = 'php'; break; default: $cp_lang = 'generic'; } // Form echo '<script type="text/javascript" src="components/com_osefileman/scripts/codepress/codepress.js"></script>'; echo "<br/><form name=\"editfrm\" id=\"editfrm\" method=\"post\" action=\"" . make_link("edit", $dir, $item) . "\">\n"; if (!empty($GLOBALS['__GET']['return_to'])) { $close_action = 'window.location=\'' . urldecode($GLOBALS['__GET']['return_to']) . '\';'; echo "<input type=\"hidden\" name=\"return_to\" value=\"" . $GLOBALS['__GET']['return_to'] . "\" />\n"; } else { $close_action = 'window.location=\'' . make_link('list', $dir, NULL) . "'"; } $submit_action = ' document.editfrm.code.value=codearea_ta.getCode();document.editfrm.submit();'; echo "\n<table class=\"adminform\">\n\t<tr>\n\t\t<td style=\"text-align: center;\">\n\t\t\t<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnsave"] . "\" onclick=\"{$submit_action}\" /> \n\t\t\t<input type=\"reset\" value=\"" . $GLOBALS["messages"]["btnreset"] . "\" /> \n\t\t\t<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnclose"] . "\" onclick=\"javascript:{$close_action}\" />\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td >\n\t\t\t<div id=\"positionIndicator\" style=\"width: 20%;float:left;\">" . $GLOBALS["messages"]["line"] . ": <input type=\"text\" name=\"txtLine\" class=\"inputbox\" size=\"6\" onchange=\"setCaretPosition(document.editfrm.code, this.value);return false;\" /> " . $GLOBALS["messages"]["column"] . ": <input type=\"text\" name=\"txtColumn\" class=\"inputbox\" size=\"6\" readonly=\"readonly\" />\n </div>\n\t\t\t<div style=\"width:70%;text-align: center;float:left;\">\n\t\t\t\t<input type=\"checkbox\" value=\"1\" name=\"return_to_dir\" id=\"return_to_dir\" />\n\t\t\t\t<label for=\"return_to_dir\">" . $GLOBALS["messages"]["returndir"] . "</label>\n\t\t\t</div>"; echo "\n\t\t</td>\n\t</tr>\n\t<tr><td>"; echo "<input type=\"hidden\" name=\"dosave\" value=\"yes\" />\n"; // Show File In TextArea $content = $GLOBALS['nx_File']->file_get_contents($fname); if (get_magic_quotes_runtime()) { $content = stripslashes($content); } $content = htmlspecialchars($content); echo '[<a href="javascript:;" onclick="positionIndicator.toggle(); codearea_ta.toggleEditor();return false;">' . $GLOBALS['messages']['editor_simple'] . ' / ' . $GLOBALS['messages']['editor_syntaxhighlight'] . '</a>]'; echo '<div id="editorarea"> <textarea class="codepress ' . $cp_lang . '" style="width:95%;" name="codearea" id="codearea" rows="25" cols="120" wrap="off" onmouseup="updatePosition(this)" onmousedown="updatePosition(this)" onkeyup="updatePosition(this)" onkeydown="updatePosition(this)" onfocus="updatePosition(this)">' . $content . '</textarea> <input type="hidden" name="code" value="" /> </div><br/>'; echo "\n\t</td>\n\t</tr>"; echo "\n\t<tr>\n\t\t<td align=\"right\">\n\t\t\t<label for=\"fname\">" . $GLOBALS["messages"]["copyfile"] . "</label>\n\t\t\t<input type=\"text\" name=\"fname\" value=\"" . $item . "\" size=\"40\" />\n\t\t</td>\n\t</tr>\n</table>\n<br/>"; echo "</form><br/>\n"; }
//move_uploaded_file($_FILES[ext]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$_FILES["ext"]["name"]); //$filename2=preg_replace('/[^a-z0-9_\-\.]/i', '_', $_FILES["ext2"]["name"]); if ($_FILES["ext1"]["tmp_name"] != "" && $_POST["ext1_chk"] != 1) { $myext1 = savefile("ext1", __racinebd__ . "list_images"); } else { if ($_POST["ext1"] != "" && $_POST["ext1_chk"] != 1) { $filename1 = preg_replace('/[^a-z0-9_\\-\\.]/i', '_', $_FILES["ext1"]["name"]); $myext1 = ",ext1='" . getext($_FILES["ext1"]["name"]) . "',nom_fichier1='" . $filename1 . "'"; } else { if ($_POST["ext1_chk"] == 1) { $myext1 = ",ext1=null"; } } } if ($_FILES["ext2"]["tmp_name"] != "" && $_POST["ext2_chk"] != 1) { $myext2 = savefile("ext2", __racinebd__ . "list_images2_"); } else { if ($_POST["ext2"] != "" && $_POST["ext2_chk"] != 1) { $filename2 = preg_replace('/[^a-z0-9_\\-\\.]/i', '_', $_FILES["ext2"]["name"]); $myext2 = ",ext2='" . getext($_FILES["ext2"]["name"]) . "',nom_fichier2='" . $filename2 . "'"; } else { if ($_POST["ext2_chk"] == 1) { $myext2 = ",ext1=null"; } } } //if(move_uploaded_file($_FILES["ext"]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$filename)===false){ //sauvegarde en base $ext1 = getext($_FILES["ext1"]["name"]); $ext2 = getext($_FILES["ext2"]["name"]); $sql = "update " . __racinebd__ . "list_images \r\n set titre1='" . addquote($_POST["titre_fichier1"]) . "',\r\n titre2='" . addquote($_POST["titre_fichier2"]) . "',\r\n lightbox='" . addquote($_POST["lightbox"]) . "',\r\n contenulightbox='" . addquote($_POST["contenu"]) . "'\r\n {$myext1}\r\n {$myext2}\r\n where images_id=" . $_POST["images_id"];
//if(move_uploaded_file($_FILES["ext"]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$filename)===false){ //sauvegarde en base $ext1 = getext($_FILES["ext1"]["name"]); $ext2 = getext($_FILES["ext2"]["name"]); /*if(PHANTOM_FULLTEXT==true){ $contenu1=addslashes(extract2tmpfile($ext1,$_FILES["ext1"]["tmp_name"])); $contenu2=addslashes(extract2tmpfile($ext2,$_FILES["ext2"]["tmp_name"])); }else{ $contenu1=addquote($_POST["description_fichier1"]); $contenu2=addquote($_POST["description_fichier2"]); }*/ $sql = "insert into " . __racinebd__ . "list_images (titre1,ext1,nom_fichier1,titre2,ext2,nom_fichier2,lightbox,contenulightbox) \r\n value('" . addquote($_POST["titre_fichier1"]) . "','" . $ext1 . "','" . $filename1 . "','" . addquote($_POST["titre_fichier2"]) . "','" . $ext2 . "','" . $filename2 . "','" . $_POST["lightbox"] . "','" . $_POST["contenu"] . "')"; $link = query($sql); $images_id = insert_id(); savefile("ext1", __racinebd__ . "list_images", $images_id); savefile("ext2", __racinebd__ . "list_images2_", $images_id); ?> <script> content='<table width="100%" style="border-bottom:1px solid black" id="table_images_<?php echo $images_id; ?> ">'; content+='<input type="hidden" name="listimages[]" value="<?php echo $images_id; ?> "/>'; content+='<textarea name="listimagescontenu[]" style="display:none"><?php echo str_replace(array("\r\n", "\n", "\r"), "", str_replace("'", "\\'", $_POST["contenu"])); ?> </textarea>'; content+='<input type="hidden" name="listimageschk[]" value="<?php
function edit_file($dir, $item) { // edit file if (($GLOBALS["permissions"] & 01) != 01) { show_error($GLOBALS["error_msg"]["accessfunc"]); } if (!get_is_file($dir, $item)) { show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]); } if (!get_show_item($dir, $item)) { show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]); } $fname = get_abs_item($dir, $item); if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") { // Save / Save As $item = base_name(stripslashes($GLOBALS['__POST']["fname"])); $fname2 = get_abs_item($dir, $item); if (!isset($item) || $item == "") { show_error($GLOBALS["error_msg"]["miscnoname"]); } if ($fname != $fname2 && @file_exists($fname2)) { show_error($item . ": " . $GLOBALS["error_msg"]["itemdoesexist"]); } savefile($fname2); $fname = $fname2; } // open file $fp = @fopen($fname, "r"); if ($fp === false) { show_error($item . ": " . $GLOBALS["error_msg"]["openfile"]); } // header $s_item = get_rel_item($dir, $item); if (strlen($s_item) > 50) { $s_item = "..." . substr($s_item, -47); } show_header($GLOBALS["messages"]["actedit"] . ": /" . $s_item); // Wordwrap (works only in IE) ?> <script language="JavaScript1.2" type="text/javascript"> <!-- function chwrap() { if(document.editfrm.wrap.checked) { document.editfrm.code.wrap="soft"; } else { document.editfrm.code.wrap="off"; } } // --> </script><?php // Form echo "<BR><FORM name=\"editfrm\" method=\"post\" action=\"" . make_link("edit", $dir, $item) . "\">\n"; echo "<input type=\"hidden\" name=\"dosave\" value=\"yes\">\n"; echo "<TEXTAREA NAME=\"code\" rows=\"25\" cols=\"120\" wrap=\"off\">"; // Show File In TextArea $buffer = ""; while (!feof($fp)) { $buffer .= fgets($fp, 4096); } @fclose($fp); echo htmlspecialchars($buffer); echo "</TEXTAREA><BR>\n<TABLE><TR><TD>Wordwrap: (IE only)</TD><TD><INPUT type=\"checkbox\" name=\"wrap\" "; echo "onClick=\"javascript:chwrap();\" value=\"1\"></TD></TR></TABLE><BR>\n"; echo "<TABLE><TR><TD><INPUT type=\"text\" name=\"fname\" value=\"" . $item . "\"></TD>"; echo "<TD><input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnsave"]; echo "\"></TD>\n<TD><input type=\"reset\" value=\"" . $GLOBALS["messages"]["btnreset"] . "\"></TD>\n<TD>"; echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnclose"] . "\" onClick=\"javascript:location='"; echo make_link("list", $dir, NULL) . "';\"></TD></TR></FORM></TABLE><BR>\n"; ?> <script language="JavaScript1.2" type="text/javascript"> <!-- if(document.editfrm) document.editfrm.code.focus(); // --> </script><?php }
} } */ } $sql = "select * from " . __racinebd__ . "langue where active=1"; $link = query($sql); while ($tbl_result = fetch($link)) { $name = $_GET["pere"] == "" || $_GET["pere"] == "0" ? $_POST["titre1"] : makename($_POST["titre1"]); if ($tbl_result["langue_id"] == $_GET["langue_id"]) { $sql = "insert into " . __racinebd__ . "contenu (arbre_id,langue_id,nom,translate) values (" . $arbre_id . "," . $tbl_result["langue_id"] . ",'" . $name . "',1)"; query($sql); $contenu_id = insert_id(); } else { $sql = "insert into " . __racinebd__ . "contenu (arbre_id,langue_id,nom,translate) values (" . $arbre_id . "," . $tbl_result["langue_id"] . ",'" . $name . "',0)"; query($sql); } } $szQuery = "insert into " . __racinebd__ . "content (titre1,ext,version_id,contenu_id)\r\nvalues ('" . addquote($_POST["titre1"]) . "',{$myext}," . $_POST["version_id"] . "," . $contenu_id . ")"; $link = query($szQuery); $id = insert_id(); //copy du master content dans les autres langues copyContent($id, $arbre_id, $_GET["langue_id"]); if ($_FILES["Filedata"]["tmp_name"] != "") { savefile("Filedata", $table, $id); } log_phantom($arbre_id, "Création du noeud"); log_phantom($arbre_id, "Modification du noeud (" . $libversion . ")"); //on deverouille $sql = "update " . __racinebd__ . "arbre set users_id_verrou=null,secure='" . $_POST["secure"] . "' where arbre_id=" . $arbre_id; query($sql); $szQuery = "";