Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Dubliuoti straipsniai

Parašė bruzgis· 2007 Gru. 2 21:12:10
#7

nekeiciau as tu visu article_cat blaballba
uztenka pakeist tik dvi nesamones
vietoj articles parasiau paprociai
vietoj article_cats parasiau paprociai_cats
likusiu nieko nekeiciau...
nu ir nereik, beje ir failuose tik tuos pacius pakeiciau ka mysql.
gal pamatysit kad duombazej kas negerai:
CREATE TABLE `prefixas_paprociai` (
  `article_id` smallint(5) unsigned NOT NULL auto_increment,
  `article_cat` smallint(5) unsigned NOT NULL default '0',
  `article_subject` varchar(200) NOT NULL default '',
  `article_snippet` text NOT NULL,
  `article_article` text NOT NULL,
  `article_breaks` char(1) NOT NULL default '',
  `article_name` smallint(5) unsigned NOT NULL default '1',
  `article_datestamp` int(10) unsigned NOT NULL default '0',
  `article_reads` smallint(5) unsigned NOT NULL default '0',
  `article_allow_comments` tinyint(1) unsigned NOT NULL default '1',
  `article_allow_ratings` tinyint(1) unsigned NOT NULL default '1',
  PRIMARY KEY  (`article_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;


INSERT INTO `prefixas_paprociai` VALUES(11, 6, 'As svecias', '', 'PHP-Fusion - jauna valdymo sistema.', 'y', 1, 1196587426, 0, 0, 0);
INSERT INTO `prefixas_paprociai` VALUES(12, 5, 'As narys', '', 'PHP-Fusion - jauna valdymo sistema.', 'y', 1, 1196587452, 0, 0, 0);
INSERT INTO `prefixas_paprociai` VALUES(13, 8, 'AS superadministratorius', '', 'PHP-Fusion - jauna valdymo sistema.', 'y', 1, 1196587471, 0, 0, 0);
INSERT INTO `prefixas_paprociai` VALUES(15, 7, 'As administratorius', '', 'PHP-Fusion - jauna valdymo sistema.', 'y', 1, 1196587524, 0, 0, 0);


CREATE TABLE `prefixas_paprociai_cats` (
  `article_cat_id` smallint(5) unsigned NOT NULL auto_increment,
  `article_cat_name` varchar(100) NOT NULL default '',
  `article_cat_description` varchar(200) NOT NULL default '',
  `article_cat_sorting` varchar(50) NOT NULL default 'article_subject ASC',
  `article_cat_access` tinyint(3) unsigned NOT NULL default '0',
  PRIMARY KEY  (`article_cat_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;



INSERT INTO `prefixas_paprociai_cats` VALUES(7, 'Administratorius', '', 'article_subject ASC', 102);
INSERT INTO `prefixas_paprociai_cats` VALUES(5, 'Narys', '', 'article_subject ASC', 101);
INSERT INTO `prefixas_paprociai_cats` VALUES(6, 'Sveèias', '', 'article_subject ASC', 0);
INSERT INTO `prefixas_paprociai_cats` VALUES(8, 'Super administratorius', '', 'article_subject ASC', 103);






Redirectina sitam faile (paprociai_skaitom.php):
if (!isset($article_id) || !isNum($article_id)) fallback("index.php");
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;

$result = dbquery(
        "SELECT ta.*,tac.*, tu.user_id,user_name FROM ".$db_prefix."paprociai ta
        INNER JOIN ".$db_prefix."paprociai_cats tac ON ta.article_cat=tac.article_cat_id
        LEFT JOIN ".$db_prefix."users tu ON ta.article_name=tu.user_id
        WHERE article_id='$article_id'"
);
$res = 0;
if (dbrows($result) != 0) {
        $data = dbarray($result);
        if (checkgroup($data['article_cat_access'])) {
                $res = 1;
                if ($rowstart == 0) $result = dbquery("UPDATE ".$db_prefix."paprociai SET article_reads=article_reads+1 WHERE article_id='$article_id'");
                $article = stripslashes($data['article_article']);
                $article = explode("<--PAGEBREAK-->", $article);
                $pagecount = count($article);
                $article_subject = stripslashes($data['article_subject']);
                $article_info = array(
                        "article_id" => $data['article_id'],
                        "user_id" => $data['user_id'],
                        "user_name" => $data['user_name'],
                        "article_date" => $data['article_datestamp'],
                        "article_breaks" => $data['article_breaks'],
                        "article_comments" => dbcount("(comment_id)", "comments", "comment_type='A' AND comment_item_id='".$data['article_id']."'"),
                        "article_reads" => $data['article_reads'],
                        "article_allow_comments" => $data['article_allow_comments']
                );
                render_article($article_subject, $article[$rowstart], $article_info);
                if (count($article) > 1) {
                        $rows = $pagecount;
                        echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,1,$rows,3,FUSION_SELF."?article_id=$article_id&amp;")."\n</div>\n";
                }
                if ($data['article_allow_comments']) showcomments("A","articles","article_id",$article_id,FUSION_SELF."?article=$article_id");
                if ($data['article_allow_ratings']) showratings("A",$article_id,FUSION_SELF."?article=$article_id");
        }
}
if ($res == 0) redirect("paprociai.php");




Dekui uz pagalba kas bande padet, jau radau klaida... vietoj paprociai buvau vienoj vietoj parases paprocai :D