Пример #1
0
function traverse_tree($parent_id, $depth_flag, &$tree_depth, &$tree_branches, &$branch_leafs)
{
    //control how deep the tree goes
    $depth_flag = $depth_flag + 1;
    //loop through categories at each level
    for ($i = 0; $i < $tree_branches; $i++) {
        //echo "looping through level $i categories PARENT ID: $parent_id<br>";
        $last_id = create_category($parent_id);
        //loop through how many products per category
        for ($j = 0; $j < $branch_leafs; $j++) {
            create_product($last_id);
            //echo "looping through level $j products LAST ID: $last_id<br>";
            //end foreach create product
        }
        //echo "<BR>1. DEPTH FLAG: $depth_flag PRIOR TO checking depth flag value<BR>";
        if ($depth_flag <= "{$tree_depth}") {
            //echo "<BR>2. DEPTH FLAG: $depth_flag TREE DEPTH: $tree_depth<BR>";
            traverse_tree($last_id, $depth_flag, $tree_depth, $tree_branches, $branch_leafs);
            //echo "<BR> 3. DEPTH FLAG: $depth_flag AFTER recursive traverse <BR>";
            //end if to traverse deeper
        }
        //end foreach categories at each level
    }
    //end function traverse_tree
}
Пример #2
0
    }
    return mysql_insert_id();
}
function create_forum($category, $orderID, $title, $description, $is_dev_blog = 0)
{
    $q = "insert into forum (category, orderID, title, description, is_dev_blog) values ({$category}, {$orderID}, '{$title}', '{$description}', {$is_dev_blog})";
    $result = mysql_query($q);
    if (!$result) {
        echo "can't create forum\n";
        echo mysql_error();
        exit;
    }
    return mysql_insert_id();
}
db_init();
$catid = create_category(0, "", 0);
create_forum($catid, 0, "News", "News from this project", 1);
create_forum($catid, 1, "Science", "Discussion of this project\\'s science");
create_forum($catid, 2, "Number crunching", "Credit, leaderboards, CPU performance");
create_forum($catid, 3, "Cafe", "Meet and greet other participants");
$catid = create_category(0, "Platform-specific problems", 1);
create_forum($catid, 0, "Windows", "Installing and running BOINC on Windows");
create_forum($catid, 1, "Unix/Linux", "Installing and running BOINC on Unix and Linux");
create_forum($catid, 2, "Macintosh", "Installing and running BOINC on Mac OS/X");
$catid = create_category(1, "General issues", 1);
create_forum($catid, 3, "Getting started", "Creating your account");
create_forum($catid, 4, "Preferences", "Using preferences");
create_forum($catid, 5, "Wish list", "What new features would you like to see?");
create_forum($catid, 6, "Web site", "Issues involving this web site");
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
Пример #3
0
require PATHS_INCLUDE . 'libraries/discussion_forum.lib.php';
require PATHS_INCLUDE . 'libraries/comments.lib.php';
require PATHS_INCLUDE . 'libraries/rank.lib.php';
$ui_options['menu_path'] = array('artiklar', 'start');
$ui_options['title'] = 'Artiklar på Hamsterpaj.net';
$ui_options['stylesheets'][] = 'articles.css';
$ui_options['stylesheets'][] = 'comments.css';
$ui_options['stylesheets'][] = 'discussion_forum.css';
$ui_options['stylesheets'][] = 'rank.css';
//$ui_options['stylesheets'][] = 'codepress.css';
$ui_options['javascripts'][] = 'comments.js';
$ui_options['javascripts'][] = 'rank.js';
$ui_options['stylesheets'][] = 'photos.css';
//$ui_options['javascripts'][] = 'photos.js';
if ($_GET['category'] == 'create' && isset($_POST["category_name"]) && is_privilegied('articles_admin')) {
    create_category($_POST["category_name"]);
}
if ($_GET['category'] == 'remove' && isset($_GET['id']) && is_privilegied('articles_admin')) {
    remove_category($_GET['id']);
}
if ($_GET['article'] == 'submit' && isset($_POST) && is_privilegied('articles_admin')) {
    if (isset($_GET['id'])) {
        update_article($_POST, $_GET['id']);
    } else {
        create_article($_POST);
    }
}
if ($_GET['article'] == 'remove' && isset($_GET['id']) && is_privilegied('articles_admin')) {
    remove_article($_GET['id']);
}
switch ($_GET['action']) {
Пример #4
0
                break;
            default:
                break;
        }
    } elseif ($ex instanceof Claro_Input_Exception) {
        $dialogBox->error(get_lang('Unset input variable'));
        $cmd = 'show';
    } else {
        $dialogBox->error(get_lang('Unexpected error'));
        $cmd = 'show';
    }
}
//handle admin commands
if ($is_allowedToEdit) {
    if ('exMkCat' == $cmd) {
        if (create_category($catName)) {
            $dialogBox->success(get_lang('The new category has been created.'));
        } else {
            $dialogBox->error(get_lang('Unable to create category'));
            $cmd = 'rqMkCat';
        }
    }
    if ('rqMkCat' == $cmd) {
        try {
            $form = new ModuleTemplate('CLFRM', 'forum_editcat.tpl.php');
            $form->assign('header', get_lang('Add a category'));
            $form->assign('catName', '');
            $form->assign('nextCommand', 'exMkCat');
            $form->assign('catId', 0);
            $dialogBox->form($form->render());
        } catch (Exception $ex) {
Пример #5
0
        exit;
    }
    return $db->insert_id();
}
function create_forum($category, $orderID, $title, $description, $is_dev_blog = 0)
{
    $q = "(category, orderID, title, description, is_dev_blog) values ({$category}, {$orderID}, '{$title}', '{$description}', {$is_dev_blog})";
    $db = BoincDB::get();
    $result = $db->insert("forum", $q);
    if (!$result) {
        $forum = BoincForum::lookup("category={$category} and title='{$title}'");
        if ($forum) {
            return $forum->id;
        }
        echo "can't create forum\n";
        echo $db->base_error();
        exit;
    }
    return $db->insert_id();
}
db_init();
$catid = create_category(0, "", 0);
$catid = create_category(1, "General Discussion", 0);
create_forum($catid, 0, "Announcements", "Announcements about Cosmology@Home");
create_forum($catid, 1, "General Topics", "General Discussion related to Cosmology@Home");
create_forum($catid, 2, "Wish list", "What features would you like to see in BOINC and Cosmology@Home");
create_forum($catid, 3, "Technical Support", "Problems with running Cosmology@Home");
$catid = create_category(2, "Cosmology@Home Science", 0);
create_forum($catid, 4, "Cosmology and Astronomy", "Questions about the Science behind Cosmology@Home");
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
Пример #6
0
// Confirm javascript code
$htmlHeadXtra[] = "<script type=\"text/javascript\">\n           function confirm_delete(name)\n           {\n               if (confirm('" . clean_str_for_javascript(get_lang('Are you sure to delete')) . " ' + name + ' ?'))\n               {return true;}\n               else\n               {return false;}\n           }\n\n           function confirm_empty(name)\n           {\n               if (confirm('" . clean_str_for_javascript(get_lang('Delete all messages of')) . " ' + name + ' ?'))\n               {return true;}\n               else\n               {return false;}\n           }\n           </script>";
if ((bool) stristr($_SERVER['PHP_SELF'], basename(__FILE__))) {
    die;
}
if (!$is_allowedToEdit) {
    die;
}
if (isset($_REQUEST['cmd'])) {
    $cmd = $_REQUEST['cmd'];
} else {
    $cmd = null;
}
if ($cmd == 'exMkCat') {
    if (trim($_REQUEST['catName']) != '') {
        if (create_category(trim($_REQUEST['catName']))) {
            $dialogBox->success(get_lang('The new category has been created.'));
        } else {
            $dialogBox->error(get_lang('Unable to create category'));
            $cmd = 'rqMkCat';
        }
    } else {
        $dialogBox->error(get_lang('Missing field(s)'));
        $cmd = 'rqMkCat';
    }
}
if ($cmd == 'rqMkCat') {
    if (isset($_REQUEST['catName'])) {
        $catName = $_REQUEST['catName'];
    } else {
        $catName = '';
 function create_remote_category($string)
 {
     if ($_POST['have-network'] === 'Yes') {
         // Get blog id we will switch to for remote category creation
         // $entry, 1 comes from form input where user selects blog.
         $switch_to = $_POST['blog-select'];
         // https://codex.wordpress.org/WPMU_Functions/switch_to_blog
         switch_to_blog($switch_to);
         create_category($string);
         restore_current_blog();
     }
 }