$cgiDir = $nof_rootDir ."/". $nof_scriptDir . "/"; $componentid = $nof_componentId; $xml_file = $nof_scriptInterfaceFile; // predefine variable values $myVars['nwadmact'] = ''; $myVars['nwpassword'] = ''; $myVars['nwoffset'] = ''; $myVars['id'] = ''; $myVars['oldimage'] = ''; $lines_array = array(); $numberoflines = 0; // working variables initialisation function nw_adm_InitParameterVariables($array, &$target) { if (!is_array($array)) { return FALSE; } $is_magic_quotes = get_magic_quotes_gpc(); foreach ($array AS $key => $value) { if (is_array($value)) { unset($target[$key]); nw_adm_InitParameterVariables($value, $target[$key]); } else if ($is_magic_quotes) { $target[$key] = stripslashes($value); } else { $target[$key] = $value; } } return TRUE; } nw_adm_InitParameterVariables(GetGVariable(''), $myVars); nw_adm_InitParameterVariables(GetPostVariable(''), $myVars); if($myVars['nwadmact']=="logout"){ SetSessionVariable('nwpassword', ''); } if($myVars['nwadmact']=="adminlogin"){ SetSessionVariable('nwpassword', $myVars['nwpassword']); } $sessionPassword = ""; $a= GetSessionVariable('nwpassword'); if ( $a!='' ) { $sessionPassword = GetSessionVariable('nwpassword'); } if ( $sessionPassword != $passw ){ ?>
}else{ $id_pos=0; $title_pos=1; $shortmessage_pos=2; $fullmessage_pos=3; $author_pos=4; $picture_pos=5; $date_pos=6; $validation_pos=7; $upload_file_name = "userfile"; if ( $myVars['nwoffset'] == "" ) { $offset=1; } else { $offset=$myVars['nwoffset']; } if (NOF_fileExists($cgiDir . "nw_lib.php")) { include_once($cgiDir."nw_lib.php"); } else { exit(); } $conf = parseXmlFile($cgiDir.$xml_file); $SNCompIdent = "admin" . "." . $componentid . "."; $dbPath = $conf[$SNCompIdent.'dbPath']; $labels = explode(",", $conf[$SNCompIdent."fields"]); $showtitle = substr($labels[0],0,1) == "1" ? true : false; $titlereq = substr($labels[0],1,1) == "1" ? true : false; $titlelabel = substr($labels[0],2); $showshortmessage = substr($labels[1],0,1) == "1" ? true : false; $shortmessagereq = substr($labels[1],1,1) == "1" ? true : false; $shortmessagelabel = substr($labels[1],2); $showfullmessage = substr($labels[2],0,1) == "1" ? true : false; $fullmessagereq = substr($labels[2],1,1) == "1" ? true : false; $fullmessagelabel = substr($labels[2],2); $showauthor = substr($labels[3],0,1) == "1" ? true : false; $authorreq = substr($labels[3],1,1) == "1" ? true : false; $authorlabel = substr($labels[3],2); $showpicture = substr($labels[4],0,1) == "1" ? true : false; $picturereq = substr($labels[4],1,1) == "1" ? true : false; $picturelabel = substr($labels[4],2); $dateformat = $conf[$SNCompIdent."dateFormat"]; $timeformat = $conf[$SNCompIdent."timeFormat"]; $timezone = $conf[$SNCompIdent."timeZone"]; $timezone = $timezone*3600; $pageSize = $conf[$SNCompIdent.'pageSize']; $msg = $GLOBALS['nof_resources']->get('nw.AddForm.Required.PleaseFill.Text'); if (!file_exists(dirname($cgiDir.$dbPath))) { NOF_throwError(540,array("{1}"=>NOF_mapPath(dirname($cgiDir.$dbPath)),"{2}"=>getcwd())); } if (!is_writable(dirname($cgiDir.$dbPath))) { NOF_throwError(541,array("{1}"=>NOF_mapPath(dirname($cgiDir.$dbPath)),"{2}"=>getcwd())); } //$fields_array is set as global in nwgetdb function if($myVars['nwadmact']=="delete"){ $lines_array=nwgetdb($cgiDir.$dbPath,0); $arr_delete=array_reverse($lines_array); if(!$FILE = @fopen($cgiDir.$dbPath, 'wb')){ NOF_throwError(500,array("{1}"=>NOF_mapPath($cgiDir.$dbPath),"{2}"=>dirname($cgiDir.$dbPath))); }else{ $strfields=implode(',',$fields_array)."\r\n"; if(!@fputs($FILE, $strfields)){ NOF_throwError(502,array("{1}"=>NOF_mapPath($cgiDir.$dbPath),"{2}"=>dirname($cgiDir.$dbPath))); } foreach($arr_delete as $line){ if($line[$id_pos]==$myVars['id']){ //delete the image if it exists if ( $line[$picture_pos] != '' ) { if ( file_exists($cgiDir."images/".$line[$picture_pos]) ) { if ( ! unlink($cgiDir."images/".$line[$picture_pos]) ) { //undable to delete the image } } } } else { for ($i=0; $i| =$GLOBALS['nof_resources']->get("nw.Admin.ViewPage.Title")?> | |
| =$titlelabel?> | =htmlspecialchars($viewline[$title_pos])?> |
| =$shortmessagelabel?> |
$desc_array=split(" ",$viewline[$shortmessage_pos]); foreach($desc_array as $val){ echo htmlspecialchars($val)." "; } ?> |
| =$fullmessagelabel?> |
$desc_array=split(" ",$viewline[$fullmessage_pos]); foreach($desc_array as $val){ echo htmlspecialchars($val)." "; } ?> |
| =$authorlabel?> | =htmlspecialchars($viewline[$author_pos])?> |
| =$GLOBALS['nof_resources']->get('nw.PostedDate.Label')?> | echo displayDate($viewline[$date_pos], $dateformat, $timeformat, $timezone) ?> |
| Picture | get('nw.Admin.Picture.Empty'); }else{ echo imgresize($cgiDir."images/",$viewline[$picture_pos],250,300); }?> |
| =$GLOBALS['nof_resources']->get("nw.Admin.Text.Status")?> | if ( trim($viewline[$validation_pos])=="true" ) { echo '' . $GLOBALS['nof_resources']->get('nw.Admin.Text.ApprovedNews') . '!'; } else { echo '' . $GLOBALS['nof_resources']->get('nw.Admin.Text.NotApprovedNews') . '!'; }?> |
| =$GLOBALS['nof_resources']->get('nw.Admin.Link.Back')?> - =$GLOBALS['nof_resources']->get('nw.Admin.Link.Edit')?> - =$GLOBALS['nof_resources']->get('nw.Admin.Link.Delete')?> - $str=""; if(trim($viewline[$validation_pos])!="true"){ $str=$GLOBALS['nof_resources']->get("nw.Admin.Link.Validate"); }else{ $str=$GLOBALS['nof_resources']->get("nw.Admin.Link.Invalidate"); } ?> =$str?> | |
| =$GLOBALS['nof_resources']->get('nw.Admin.Link.Logout')?> | if($flag_emptydb==0 and $numberoflines!=0){ displaypages($offset,$numberoflines,$pageSize,5,''); } ?> |