Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites
View Statistics - Next Notice - Previous NoticeDirectory filter : [ all ] / postnuke_official / tests [ view in CVS ]
Date | Directory [filter] | File(s) [view] | Author [filter] |
28 Jul 2002 16:05:12 | postnuke_official/tests | import8.php,1.9,1.10 | Mike |
work with new/old categories create API |
Update of /home/cvsroot/postnuke_official/tests In directory ns7.hostnuke.net:/tmp/cvs-serv1843 Modified Files: import8.php Log Message: work with new/old categories create API Index: import8.php =================================================================== RCS file: /home/cvsroot/postnuke_official/tests/import8.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** import8.php 27 Jul 2002 18:57:32 -0000 1.9 --- import8.php 28 Jul 2002 16:05:10 -0000 1.10 *************** *** 104,197 **** } if ($reset) { ! $dbconn->Execute("DELETE FROM " . $pntable['categories']); ! $dbconn->Execute("DELETE FROM " . $pntable['categories_linkage']); } - $cats = pnModAPIFunc('categories', 'user', 'getcat', array()); if (!pnModAPILoad('categories','admin')) { die("Unable to load the categories admin API"); } echo "Creating root for old news topics<br>\n"; ! if (count($cats) > 0) { ! $topics = pnModAPIFunc('categories', 'admin', 'createcat', array( ! 'name' => 'Topics', ! 'description' => 'Old news topics', ! 'catexists' => 1, ! 'refcid' => 1, ! 'inorout' => 'out', ! 'rightorleft' => 'right')); ! } ! else { ! $topics = pnModAPIFunc('categories', 'admin', 'createcat', array( ! 'name' => 'Topics', ! 'description' => 'Old news topics', ! 'catexists' => 0, ! 'refcid' => 1, ! 'inorout' => 'out', ! 'rightorleft' => 'right')); } ! if ($topics > 0) { ! echo "Creating root for old news categories<br>\n"; ! $categories = pnModAPIFunc('categories', 'admin', 'createcat', array( ! 'name' => 'Categories', ! 'description' => 'Old news categories', ! 'catexists' => 1, ! 'refcid' => $topics, ! 'inorout' => 'out', ! 'rightorleft' => 'right')); ! // preset the article categories to those two types ! if ($reset) { ! pnModSetVar('articles', 'number_of_categories', 2); ! pnModSetVar('articles', 'cids', "$topics;$categories"); ! } ! echo "Creating old default 'Articles' news category<br>\n"; ! $catid[0] = pnModAPIFunc('categories', 'admin', 'createcat', array( ! 'name' => 'Articles', ! 'description' => 'Old default news category', ! 'catexists' => 1, ! 'refcid' => $categories, ! 'inorout' => 'in', ! 'rightorleft' => 'right')); ! $query = 'SELECT pn_topicid, pn_topicname, pn_topictext, pn_topicimage ! FROM ' . $oldprefix . '_topics'; ! $result = $dbconn->Execute($query); ! if ($dbconn->ErrorNo() != 0) { ! die("Oops, select topics failed : " . $dbconn->ErrorMsg()); ! } ! while (!$result->EOF) { ! list($id, $name, $text, $image) = $result->fields; ! $topicid[$id] = pnModAPIFunc('categories', 'admin', 'createcat', array( 'name' => $text, 'description' => "Topic $name", 'image' => "$imgurl/topics/$image", ! 'catexists' => 1, ! 'refcid' => $topics, ! 'inorout' => 'in', ! 'rightorleft' => 'right')); ! echo "Creating topic ($id) $text - $name [$image]<br>\n"; ! $result->MoveNext(); ! } ! $result->Close(); ! $query = 'SELECT pn_catid, pn_title ! FROM ' . $oldprefix . '_stories_cat'; ! $result = $dbconn->Execute($query); ! if ($dbconn->ErrorNo() != 0) { ! die("Oops, select stories_cat failed : " . $dbconn->ErrorMsg()); ! } ! while (!$result->EOF) { ! list($id, $title) = $result->fields; ! $catid[$id] = pnModAPIFunc('categories', 'admin', 'createcat', array( 'name' => $title, 'description' => $title, ! 'catexists' => 1, ! 'refcid' => $categories, ! 'inorout' => 'in', ! 'rightorleft' => 'right')); ! echo "Creating category ($id) $title - $title<br>\n"; ! $result->MoveNext(); ! } ! $result->Close(); } echo "<strong>TODO : copy the topic images to modules/categories/pnimages or elsewhere someday</strong><br><br>\n"; --- 104,168 ---- } if ($reset) { ! // $dbconn->Execute("DELETE FROM " . $pntable['categories']); ! $dbconn->Execute("DELETE FROM " . $pntable['categories_linkage'] . " WHERE pn_modid=151"); } if (!pnModAPILoad('categories','admin')) { die("Unable to load the categories admin API"); } echo "Creating root for old news topics<br>\n"; ! $topics = pnModAPIFunc('categories', 'admin', 'create', array( ! 'name' => 'Topics', ! 'description' => 'Old news topics', ! 'parent_id' => 0)); ! echo "Creating root for old news categories<br>\n"; ! $categories = pnModAPIFunc('categories', 'admin', 'create', array( ! 'name' => 'Categories', ! 'description' => 'Old news categories', ! 'parent_id' => 0)); ! // preset the article categories to those two types ! if ($reset) { ! pnModSetVar('articles', 'number_of_categories', 2); ! pnModSetVar('articles', 'cids', "$topics;$categories"); } ! echo "Creating old default 'Articles' news category<br>\n"; ! $catid[0] = pnModAPIFunc('categories', 'admin', 'create', array( ! 'name' => 'Articles', ! 'description' => 'Old default news category', ! 'parent_id' => $categories)); ! $query = 'SELECT pn_topicid, pn_topicname, pn_topictext, pn_topicimage ! FROM ' . $oldprefix . '_topics'; ! $result = $dbconn->Execute($query); ! if ($dbconn->ErrorNo() != 0) { ! die("Oops, select topics failed : " . $dbconn->ErrorMsg()); ! } ! while (!$result->EOF) { ! list($id, $name, $text, $image) = $result->fields; ! $topicid[$id] = pnModAPIFunc('categories', 'admin', 'create', array( 'name' => $text, 'description' => "Topic $name", 'image' => "$imgurl/topics/$image", ! 'parent_id' => $topics)); ! echo "Creating topic ($id) $text - $name [$image]<br>\n"; ! $result->MoveNext(); ! } ! $result->Close(); ! $query = 'SELECT pn_catid, pn_title ! FROM ' . $oldprefix . '_stories_cat'; ! $result = $dbconn->Execute($query); ! if ($dbconn->ErrorNo() != 0) { ! die("Oops, select stories_cat failed : " . $dbconn->ErrorMsg()); ! } ! while (!$result->EOF) { ! list($id, $title) = $result->fields; ! $catid[$id] = pnModAPIFunc('categories', 'admin', 'create', array( 'name' => $title, 'description' => $title, ! 'parent_id' => $categories)); ! echo "Creating category ($id) $title - $title<br>\n"; ! $result->MoveNext(); } + $result->Close(); echo "<strong>TODO : copy the topic images to modules/categories/pnimages or elsewhere someday</strong><br><br>\n"; *************** *** 251,261 **** echo "<strong>5. Importing old sections into categories</strong><br>\n"; echo "Creating root for old sections<br>\n"; ! $sections = pnModAPIFunc('categories', 'admin', 'createcat', array( 'name' => 'Sections', 'description' => 'Root for old sections', ! 'catexists' => 1, ! 'refcid' => $categories, ! 'inorout' => 'out', ! 'rightorleft' => 'right')); if ($sections > 0) { $query = 'SELECT pn_secid, pn_secname, pn_image --- 222,229 ---- echo "<strong>5. Importing old sections into categories</strong><br>\n"; echo "Creating root for old sections<br>\n"; ! $sections = pnModAPIFunc('categories', 'admin', 'create', array( 'name' => 'Sections', 'description' => 'Root for old sections', ! 'parent_id' => 0)); if ($sections > 0) { $query = 'SELECT pn_secid, pn_secname, pn_image *************** *** 267,278 **** while (!$result->EOF) { list($id, $name, $image) = $result->fields; ! $sectionid[$id] = pnModAPIFunc('categories', 'admin', 'createcat', array( 'name' => $name, 'description' => "Section $name", 'image' => "$imgurl/sections/$image", ! 'catexists' => 1, ! 'refcid' => $sections, ! 'inorout' => 'in', ! 'rightorleft' => 'right')); echo "Creating section ($id) $name [$image]<br>\n"; $result->MoveNext(); --- 235,243 ---- while (!$result->EOF) { list($id, $name, $image) = $result->fields; ! $sectionid[$id] = pnModAPIFunc('categories', 'admin', 'create', array( 'name' => $name, 'description' => "Section $name", 'image' => "$imgurl/sections/$image", ! 'parent_id' => $sections)); echo "Creating section ($id) $name [$image]<br>\n"; $result->MoveNext();
View Statistics - Next Notice - Previous Notice
Visit Developer Site - Browse CVS Repository |
Syndicate via backend.rss (max. once per hour please) | Powered by CVSNotice 0.1.3 |