OSI-Certified logo

Source code of file adm_syndman.php
from the Content Management module for Phprojekt.

<?php
// Content Management System module for PHProjekt (CMS4P).
// Copyright 2002-2005 by Mario A. Valdez-Ramirez
// http://www.mariovaldez.net/

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, 
// Boston, MA 02111-1307, USA.

// You can contact Mario A. Valdez-Ramirez by email 
// at mario@mariovaldez.org or paper mail at 
// Olmos 809, San Nicolas, NL. 66495, Mexico.

//session_start();
$path_pre="../";
include_once (
$path_pre "cm/cm_anon.inc.php");
$include_path $path_pre "lib/lib.inc.php";
include_once 
$include_path;
include_once (
$path_pre "cm/cm_lib.inc.php");
fcm_load_secdb ($cm_security);
echo 
$cm_html_header;



function 
fcm_display_selform () {
  global 
$cm_text$cmru;
  
$result1 db_query("select cmdb_title, cmdb_ttl, cmdb_autodl, cmdb_inhome, cmdb_visitems, cmdb_uri, cmdb_date_update from " CM_DB_PREFIX "cmsynd3 order by upper(cmdb_title)") or db_die();
  echo 
"<p class=\"generaltext\">{$cm_text["synd-selectasynd"]}</p>";
  echo 
"<form class=\"cms\" action=\"adm_syndman.php\" method=\"post\" id=\"cm_syndeditform\">\n";
  echo 
"<input type=\"hidden\" name=\"cmru\" value=\"$cmru\">";
  echo 
"<select class=\"cms\" name=\"cm_sel_newsfeed\" size=\"15\">\n";
  while (
$row1 db_fetch_row($result1)) {
    echo 
"<option class=\"cms\" value=\"$row1[0]\">";
    echo 
"$row1[0] -- ($row1[1] $row1[4]";
    if (
$row1[2]) { echo " [+]"; } else { echo " [-]"; } 
    if (
$row1[3]) { echo " [+] "; } else { echo " [-] "; }
    echo 
substr ($row1[5], 735) . "... ";
    echo 
$row1[6]; 
    echo 
")</option>\n";
  }
  echo 
"</select><br>\n";
  echo 
"<input class=\"cms\" type=\"submit\" name=\"cm_addsynd\" value=\"{$cm_text["synd-addsynd"]}\"><br>\n";
  echo 
"<input class=\"cms\" type=\"submit\" name=\"cm_delsynd\" value=\"{$cm_text["synd-delsynd"]}\"><br>\n";
  echo 
"<input class=\"cms\" type=\"submit\" name=\"cm_editsynd\" value=\"{$cm_text["synd-editsynd"]}\"><br>\n";
  echo 
"</form>\n";
  echo 
"<hr>\n";
  echo 
"<p class=\"titletext\" align=\"center\">{$cm_text["synd-moresynd"]}</p>\n";
  echo 
"<table border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"\n>";
  echo 
"<tr><td class=\"console2body\" valign=\"top\"><ul class=\"cms\">";
  echo 
"<li class=\"reflink\"><a class=\"cms\" href=\"http://www.feedroom.com/rssmain.jsp\" TARGET=\"_blank\">The FeedRoom</a>.</li>\n";
  echo 
"<li class=\"reflink\"><a class=\"cms\" href=\"http://newsfeeds.manilasites.com/\" TARGET=\"_blank\">NewsFeeds</a> (at ManilaSites).</li>\n";
  echo 
"<li class=\"reflink\"><a class=\"cms\" href=\"http://www.syndic8.com/\" TARGET=\"_blank\">Syndic8</a>.</li>\n";
  echo 
"</ul></td></tr>";
  echo 
"</table>\n";
}


if (
$cmru) {
  echo 
"<p class=\"setupreturn\"><a class=\"cms\"href=\"" $cmru ".php\">{$cm_text["setup-return"]}</a></p>";
}

if ((
$cm_superuser) && ($cm_superuser == $user_kurz)) {
  echo 
"<p class=\"titletext\">{$cm_text["synd-welcome"]}</p>";

  if (
$cm_delsynd) {
    if (
$cm_sel_newsfeed) {
      
$result1 db_query("delete from " CM_DB_PREFIX "cmsynd3 where cmdb_title like '$cm_sel_newsfeed'") or db_die();
      
fcm_message ($cm_text["synd-deletedsynd"], CM_MSGSTYLE_INFORMATION);
      
fcm_add_logentry (""$user_kurzCM_APPLOG_EDIT_SYND"Deleted syndication newsfeed $cm_sel_newsfeed.");
      
fcm_display_selform ();
    }
    else {
      
fcm_display_selform ();
    }
  }
  elseif (
$cm_editsynd) {
    if (
$cm_sel_newsfeed) {
      
$result1 db_query("select cmdb_uri, cmdb_title, cmdb_ttl, cmdb_autodl, cmdb_inhome, cmdb_visitems from " CM_DB_PREFIX "cmsynd3 where cmdb_title = '" $cm_sel_newsfeed "'") or db_die();
      
$row1 db_fetch_row($result1);
      echo 
"<form class=\"cms\" action=\"adm_syndman.php\" method=\"post\" id=\"cm_syndeditform\">\n";
      echo 
"<input type=\"hidden\" name=\"cmru\" value=\"$cmru\">";
      echo 
"<span class=\"inputname\">{$cm_text["synd-title"]}:</span> <span class=\"pseudoinput\">$cm_sel_newsfeed</span>";
      echo 
"<input type=\"hidden\" name=\"cm_synd_title\" value=\"$cm_sel_newsfeed\"><br>\n";
      echo 
"<span class=\"inputname\">{$cm_text["synd-url"]}:</span><br>";
      echo 
"<input class=\"cms\" type=\"text\" name=\"cm_synd_url\" value=\"$row1[0]\"size=\"50\" maxlength=\"255\"><br>\n";
      echo 
"<span class=\"inputname\">{$cm_text["synd-ttl"]}:</span>&nbsp;";
      
fcm_val_droplist ("cm_synd_ttl", array(1,5,10,30,60,120,300,600,900,1440), $row1[2]);
      echo 
"<input class=\"cms\" type=\"checkbox\" name=\"cm_synd_autodl\" value=\"1\"";
      if (
$row1[3]) {
        echo 
"checked";
      }
      echo 
">&nbsp;";
      echo 
"<span class=\"inputname\">{$cm_text["synd-autodl"]}</span><br>\n";
      echo 
"<input class=\"cms\" type=\"checkbox\" name=\"cm_synd_showinhome\" value=\"1\"";
      if (
$row1[4]) {
        echo 
"checked";
      }
      echo 
">&nbsp;";
      echo 
"<span class=\"inputname\">{$cm_text["synd-showinhome"]}</span><br>\n";
      echo 
"<span class=\"inputname\">{$cm_text["synd-maxitems"]}:</span>&nbsp;";
      
fcm_val_droplist ("cm_synd_maxitems", array(1,3,5,7,10,15,20,30), $row1[5]);
      echo 
"<hr><input class=\"cms\" type=\"submit\" name=\"cm_savesynd\" value=\"{$cm_text["synd-savesynd"]}\">\n";
      echo 
"<input class=\"cms\" type=\"submit\" name=\"cm_cancel\" value=\"{$cm_text["synd-cancelsynd"]}\"><br>\n";
      echo 
"</form>\n";
    }
    else {
      
fcm_display_selform ();
    }
  }
  elseif (
$cm_addsynd) {
    echo 
"<form class=\"cms\" action=\"adm_syndman.php\" method=\"post\" id=\"cm_syndeditform\">\n";
    echo 
"<input type=\"hidden\" name=\"cmru\" value=\"$cmru\">";
    echo 
"<span class=\"inputname\">{$cm_text["synd-title"]}:</span><br>";
    echo 
"<input class=\"cms\" type=\"text\" name=\"cm_synd_title\" size=\"20\" maxlength=\"20\"><br>\n";
    echo 
"<span class=\"inputname\">{$cm_text["synd-url"]}:</span><br>";
    echo 
"<input class=\"cms\" type=\"text\" name=\"cm_synd_url\" size=\"50\" maxlength=\"255\"><br>\n";
    echo 
"<span class=\"inputname\">{$cm_text["synd-ttl"]}:</span>&nbsp;";
    
fcm_val_droplist ("cm_synd_ttl", array(1,5,10,30,60,120,300,600,900,1440), 300);
    echo 
"<input class=\"cms\" type=\"checkbox\" name=\"cm_synd_autodl\" value=\"1\" checked>&nbsp;";
    echo 
"<span class=\"inputname\">{$cm_text["synd-autodl"]}</span><br>\n";
    echo 
"<input class=\"cms\" type=\"checkbox\" name=\"cm_synd_showinhome\" value=\"1\" checked>&nbsp;";
    echo 
"<span class=\"inputname\">{$cm_text["synd-showinhome"]}</span><br>\n";
    echo 
"<span class=\"inputname\">{$cm_text["synd-maxitems"]}:</span>&nbsp;";
    
fcm_val_droplist ("cm_synd_maxitems", array(1,3,5,7,10,15,20,30), 5);
    echo 
"<hr><input class=\"cms\" type=\"submit\" name=\"cm_savesynd\" value=\"{$cm_text["synd-savesynd"]}\">\n";
    echo 
"<input class=\"cms\" type=\"submit\" name=\"cm_cancel\" value=\"{$cm_text["synd-cancelsynd"]}\"><br>\n";
    echo 
"</form>\n";
  }
  elseif (
$cm_savesynd) {
    
$cm_pub_date fcm_curdate_string ();
    
$cm_old_date "1999-01-01 01:01:01";
    
$cm_synd_autodl abs ($cm_synd_autodl);
    
$cm_synd_showinhome abs ($cm_synd_showinhome);
    
$cm_synd_maxitems abs ($cm_synd_maxitems);
    
$result1 db_query("select cmdb_type, cmdb_title from " CM_DB_PREFIX "cmsynd3 where cmdb_title like '$cm_synd_title'") or db_die();
    
$row1 db_fetch_row($result1);
    if (
$row1[0]) {
      
$result2 db_query("update " CM_DB_PREFIX "cmsynd3 set cmdb_uri='$cm_synd_url', cmdb_date_creation='$cm_pub_date', cmdb_date_update='$cm_old_date', cmdb_ttl=$cm_synd_ttl,cmdb_autodl=$cm_synd_autodl,cmdb_inhome=$cm_synd_showinhome,cmdb_visitems=$cm_synd_maxitems where cmdb_title like '$cm_synd_title'") or db_die();
      
fcm_add_logentry (""$user_kurzCM_APPLOG_EDIT_SYND"Edited syndication newsfeed $cm_synd_title");
      
fcm_message ($cm_text["synd-editedsynd"], CM_MSGSTYLE_INFORMATION);
    }
    else {
      
$result2 db_query("insert into " CM_DB_PREFIX "cmsynd3 values($dbIDnull,'" CM_HITTYPE_SYND "','$cm_synd_url','$cm_synd_title',null,'$cm_pub_date','$cm_old_date',$cm_synd_ttl,$cm_synd_autodl,$cm_synd_showinhome,$cm_synd_maxitems,'$cm_rdf_content')") or db_die();
      
fcm_add_logentry (""$user_kurzCM_APPLOG_EDIT_SYND"Added syndication newsfeed $cm_synd_title");
      
fcm_message ($cm_text["synd-addedsynd"], CM_MSGSTYLE_INFORMATION);
    }
    
fcm_display_selform ();
  }
  else {
    
fcm_display_selform ();
  }
}
else {
  echo 
"<p class=\"titletext\">{$cm_text["synd-welcome"]}</p>";
  echo 
"<p class=\"generaltext\">{$cm_text["setup-currentuser"]} <strong>$user_kurz</strong><br>";
  echo 
"{$cm_text["setup-superuseris"]} <strong>$cm_superuser</strong></p>";
  
fcm_message ($cm_text["synd-nosuperuser"], CM_MSGSTYLE_ERROR);
  
fcm_add_logentry (""$user_kurzCM_APPLOG_ERROR"Error when editing syndication newsfeeds. Not enough permissions.");
}


if (
$cmru) {
  echo 
"<p class=\"setupreturn\"><a class=\"cms\"href=\"" $cmru ".php\">{$cm_text["setup-return"]}</a></p>";
}


echo 
$cm_html_footer;
?>

 
 
NA fum/lmd: 2004.09.16
Copyright ©1994-2018 by Mario A. Valdez-Ramírez.
no siga este enlace / do not follow this link