コード例 #1
1
 function testSetupMulticomicPartialPaths()
 {
     $cp = $this->getMock('ComicPress', array('_is_dir'));
     wp_set_post_categories(1, array('2', '3'));
     add_category('2', (object) array('slug' => 'test-one'));
     add_category('3', (object) array('slug' => 'test-two'));
     $cp->expects($this->at(0))->method('_is_dir')->with('/subthemes/test-one')->will($this->returnValue(true));
     $cp->expects($this->at(1))->method('_is_dir')->with('/subthemes/test-two')->will($this->returnValue(false));
     $cp->setup_multicomic_partial_paths(1);
     $this->assertEquals(array('/subthemes/test-one'), $cp->partial_paths);
 }
コード例 #2
0
ファイル: category.php プロジェクト: NguyenThanhDung/Finance
function submit_add_category($config)
{
    $name = $_POST['name'];
    $receipt = $_POST['type'] == "receipt" ? 1 : 0;
    $description = $_POST['description'];
    return add_category($config, $name, $receipt, $description);
}
コード例 #3
0
 function testGetPostCategories()
 {
     global $comicpress_manager;
     add_category(1, (object) array('name' => 'comics'));
     add_category(2, (object) array('name' => 'comics2'));
     // subdirectory
     update_option('comicpress-manager-manage-subcomic', "2");
     $comicpress_manager = $this->getMock('ComicPressManager', array('normalize_storyline_structure', 'get_subcomic_directory'));
     $comicpress_manager->expects($this->once())->method('normalize_storyline_structure')->will($this->returnValue(array('category_tree' => array('0/1'))));
     $comicpress_manager->properties = array('comiccat' => 1);
     $comicpress_manager->expects($this->once())->method('get_subcomic_directory')->will($this->returnValue("comic2"));
     $a = new ComicPressPostEditor();
     $this->assertEquals(array(2), $a->post_categories);
     // first in storyline
     update_option('comicpress-manager-manage-subcomic', "0");
     $comicpress_manager = $this->getMock('ComicPressManager', array('normalize_storyline_structure', 'get_subcomic_directory', 'get_cpm_option'));
     $comicpress_manager->expects($this->once())->method('normalize_storyline_structure')->will($this->returnValue(array('category_tree' => array('0/1', '0/2'))));
     $comicpress_manager->properties = array('comiccat' => 1);
     $comicpress_manager->expects($this->once())->method('get_subcomic_directory')->will($this->returnValue(false));
     $comicpress_manager->expects($this->once())->method('get_cpm_option')->with('cpm-default-comic-category-is-last-storyline')->will($this->returnValue(0));
     $a = new ComicPressPostEditor();
     $this->assertEquals(array(1), $a->post_categories);
     // last in storyline
     update_option('comicpress-manager-manage-subcomic', "0");
     $comicpress_manager = $this->getMock('ComicPressManager', array('normalize_storyline_structure', 'get_subcomic_directory', 'get_cpm_option'));
     $comicpress_manager->expects($this->once())->method('normalize_storyline_structure')->will($this->returnValue(array('category_tree' => array('0/1', '0/2'))));
     $comicpress_manager->properties = array('comiccat' => 1);
     $comicpress_manager->expects($this->once())->method('get_subcomic_directory')->will($this->returnValue(false));
     $comicpress_manager->expects($this->once())->method('get_cpm_option')->with('cpm-default-comic-category-is-last-storyline')->will($this->returnValue(1));
     $a = new ComicPressPostEditor();
     $this->assertEquals(array(2), $a->post_categories);
 }
コード例 #4
0
 /**
  * @dataProvider providerTestGetCategoriesToExclude
  */
 function testGetCategoriesToExclude($input, $expected_output)
 {
     add_category(1, (object) array('slug' => 'one'));
     add_category(2, (object) array('slug' => 'one'));
     add_category(3, (object) array('slug' => 'one'));
     $dbi = new ComicPressDBInterface();
     $this->assertEquals($expected_output, $dbi->_get_categories_to_exclude($input));
 }
コード例 #5
0
 /**
  * @dataProvider providerTestFindParents
  */
 function testFindParents($post_categories, $expected_result)
 {
     add_category(1, (object) array('slug' => 'root', 'parent' => 0));
     add_category(2, (object) array('slug' => 'comic', 'parent' => 1));
     add_category(3, (object) array('slug' => 'part-1', 'parent' => 2));
     add_category(4, (object) array('slug' => 'blog', 'parent' => 1));
     wp_set_post_categories(1, $post_categories);
     $this->p->post = (object) array('ID' => 1);
     $this->assertEquals($expected_result, $this->p->find_parents());
 }
コード例 #6
0
 function testSetComicCategories()
 {
     $dbi = ComicPressDBInterface::get_instance();
     for ($i = 1; $i <= 4; ++$i) {
         add_category($i, (object) array());
     }
     $dbi->set_comic_categories(array(2, 3));
     $this->assertEquals(array(1, 2, 3, 4), $dbi->_all_categories);
     $this->assertEquals(array(1, 4), $dbi->_non_comic_categories);
 }
コード例 #7
0
ファイル: index.php プロジェクト: jonPlancey/cs6252_hw05
function add_categories()
{
    $category = filter_input(INPUT_POST, 'category_name');
    if ($category == NULL) {
        $error = "Invalid category name. Check name and try again.";
        include 'view/error.php';
    } else {
        add_category($category);
        header('Location: .?action=list_categories');
    }
}
コード例 #8
0
 /**
  * @dataProvider providerTestHandleUpdate
  */
 function testHandleUpdate($original, $change, $new)
 {
     $this->core->comicpress = $this->getMock('ComicPress', array('save', 'init'));
     $this->core->comicpress->comicpress_options = array('comic_category_id' => 1, 'comic_dimensions' => '760x', 'rss_dimensions' => '350x', 'archive_dimensions' => '125x');
     $this->core->comicpress->comicpress_options = array_merge($this->core->comicpress->comicpress_options, $original);
     add_category(2, (object) array('name' => 'test'));
     $_POST = $change;
     $this->core->handle_update_comicpress_options($_POST['cp']);
     foreach ($new as $key => $value) {
         $this->assertEquals($value, $this->core->comicpress->comicpress_options[$key]);
     }
 }
コード例 #9
0
 function setUp()
 {
     global $comicpress_manager;
     _reset_wp();
     $comicpress_manager = $this->getMock('ComicPressManager', array('generate_example_date', 'get_subcomic_directory', 'normalize_storyline_structure'));
     $comicpress_manager->expects($this->once())->method('generate_example_date');
     $comicpress_manager->expects($this->once())->method('get_subcomic_directory')->will($this->returnValue(false));
     $comicpress_manager->expects($this->once())->method('normalize_storyline_structure')->will($this->returnValue(array('category_tree' => array('0/1'))));
     $comicpress_manager->properties = array('comiccat' => 1);
     add_category(1, (object) array('name' => 'comic'));
     $this->u = new ComicPressUpload();
 }
コード例 #10
0
 function testRemoveAllCategories()
 {
     global $wp_test_expectations;
     update_option('default_category', 0);
     for ($i = 0; $i < 5; ++$i) {
         add_category($i, (object) array('slug' => 'test-' . $i));
     }
     $this->assertEquals(5, count($wp_test_expectations['categories']));
     $this->pf->remove_all_categories();
     $this->assertEquals(1, count($wp_test_expectations['categories']));
     $result = get_category(0);
     $this->assertTrue(isset($result->term_id));
 }
コード例 #11
0
 /**
  * @dataProvider providerTestFindFile
  */
 function testFindFile($files_to_setup, $search_path, $post_categories, $expected_path_result)
 {
     global $post;
     mkdir(vfsStream::url('root/parent/partials/comic/chapter-1'), 0777, true);
     mkdir(vfsStream::url('root/child/partials/comic/chapter-1'), 0777, true);
     foreach ($files_to_setup as $path) {
         file_put_contents(vfsStream::url($path), "test");
     }
     _set_template_directory(vfsStream::url('root/parent'));
     _set_stylesheet_directory(vfsStream::url('root/child'));
     $post = (object) array('ID' => 1);
     wp_set_post_categories(1, array(2));
     add_category(1, (object) array('slug' => 'comic', 'parent' => 0));
     add_category(2, (object) array('slug' => 'chapter-1', 'parent' => 1));
     $this->assertEquals($expected_path_result, $this->cp->find_file('index.inc', $search_path, $post_categories));
 }
コード例 #12
0
 function testGenerateAdditionalCategoriesCheckboxes()
 {
     global $comicpress_manager;
     $comicpress_manager = $this->getMock("ComicPressManager", array('get_cpm_option'));
     $comicpress_manager->properties['blogcat'] = 1;
     $this->v->category_tree = array('0/2');
     $comicpress_manager->expects($this->once())->method('get_cpm_option')->will($this->returnValue("4"));
     add_category(3, (object) array('cat_name' => 'Test', 'parent' => 0));
     add_category(4, (object) array('cat_name' => 'Test 2', 'parent' => 0));
     $result = $this->v->_generate_additional_categories_checkboxes();
     $this->assertTrue(count($result) == 2);
     $this->assertTrue(count($this->v->category_checkboxes) == 2);
     $this->assertTrue(($first = _to_xml($result[0])) !== false);
     $this->assertTrue(_node_exists($first, '//label/input[@value="3" and not(@checked="checked")]'));
     $this->assertTrue(($second = _to_xml($result[1])) !== false);
     $this->assertTrue(_node_exists($second, '//label/input[@value="4" and @checked="checked"]'));
 }
 function testRenderGenerationStates()
 {
     global $comicpress_manager, $comicpress_manager_admin;
     add_category(1, (object) array('name' => 'Comics'));
     add_category(2, (object) array('name' => 'Blog'));
     $s = new ComicPressSidebarStandard();
     $s->thumbnail_generation = array('rss' => true, 'archive' => array("test"));
     $comicpress_manager_admin = $this->getMock('ComicPressManagerAdmin', array('show_debug_info'));
     ob_start();
     $s->render();
     $source = ob_get_clean();
     $this->assertTrue(($xml = _to_xml($source, true)) !== false);
     foreach (array() as $xpath => $value) {
         $this->assertTrue(_xpath_test($xml, $xpath, $value), $xpath);
     }
     $this->markTestIncomplete();
 }
 /**
  * @dataProvider providerTestProcessSearchString
  */
 function testProcessSearchString($string, $expected_searches, $post_id_to_use = 1)
 {
     $fs = $this->getMock('ComicPressBackendFilesystemFactory', array('_replace_wordpress'));
     $fs->expects($this->any())->method('_replace_wordpress')->will($this->returnValue('/wordpress'));
     $posts = array(1 => (object) array('ID' => 1, 'post_date' => '2009-01-01'), 2 => (object) array('ID' => 2, 'post_date' => '2009-01-01'));
     add_category(1, (object) array('slug' => 'parent', 'parent' => 0));
     add_category(2, (object) array('slug' => 'child', 'parent' => 1));
     add_category(4, (object) array('slug' => 'bad', 'parent' => 3));
     wp_set_post_categories(1, array(2));
     wp_set_post_categories(2, array(4));
     update_option('upload_path', 'upload');
     update_option('home', 'http://wordpress/');
     $fs->search_string = $string;
     $comicpress = ComicPress::get_instance(true);
     $comicpress->comicpress_options = array('backend_options' => array('filesystem' => array('folders' => array('comic' => 'comic-folder'))));
     $this->assertEquals($expected_searches, $fs->process_search_string($posts[$post_id_to_use], 'comic', 'filename.jpg'));
 }
コード例 #15
0
ファイル: admin.php プロジェクト: nijikokun/NinkoBB
     $success = lang('success_edited_cat');
 }
 if (isset($_POST['add'])) {
     // Convert checkboxes
     if ($_POST['aop'] == "on") {
         $_POST['aop'] = 1;
     } else {
         $_POST['aop'] = 0;
     }
     if ($_POST['aot'] == "on") {
         $_POST['aot'] = 1;
     } else {
         $_POST['aot'] = 0;
     }
     // Results
     $result = add_category($_POST['name'], $_POST['order'], $_POST['aop'], $_POST['aot']);
     // Check Results
     if ($result === "INVALID_ID") {
         $error = lang_parse('error_invalid_given', array(lang('id')));
     } else {
         if (!$result) {
             $error = lang('error_adding_cat');
         }
     }
     // No errors?
     if (!$error) {
         $success = lang('success_cat');
     }
 }
 /**
  * Include header
コード例 #16
0
 function testHandleWarnings()
 {
     global $comicpress_manager;
     foreach (array('messages', 'warnings') as $type) {
         $comicpress_manager = (object) array($type => array('test'), 'show_config_editor' => false);
         ob_start();
         $this->assertTrue($this->adm->handle_warnings());
         $result = ob_get_clean();
         $this->assertTrue(!empty($result), $type);
         $this->assertTrue(($xml = _to_xml($result)) !== false);
         $this->assertTrue(_node_exists($xml, '//div[@id="cpm-' . $type . '"]'));
         $this->assertFalse(strpos($result, "You won't be able") !== false);
         $this->assertFalse(strpos($result, "Debug info") !== false);
     }
     $adm = $this->getMock('ComicPressManagerAdmin', array('edit_config', 'get_backup_files'));
     $adm->expects($this->any())->method('edit_config');
     $adm->expects($this->any())->method('get_backup_files')->will($this->returnValue(array()));
     $comicpress_manager = $this->getMock('ComicPressManager', array('get_subcomic_directory'));
     $comicpress_manager->errors = array('test');
     $comicpress_manager->show_config_editor = false;
     $comicpress_manager->config_method = "";
     ob_start();
     $this->assertFalse($adm->handle_warnings());
     $result = ob_get_clean();
     $this->assertTrue(strpos($result, "You won't be able") !== false);
     $this->assertTrue(strpos($result, "Debug info") !== false);
     $comicpress_manager = $this->getMock('ComicPressManager', array('get_subcomic_directory'));
     $comicpress_manager->errors = array('test');
     $comicpress_manager->show_config_editor = true;
     $comicpress_manager->config_method = "";
     add_category(1, (object) array('name' => 'Test'));
     ob_start();
     $this->assertFalse($adm->handle_warnings());
     $result = ob_get_clean();
     $this->assertTrue(strpos($result, "You won't be able") !== false);
     $this->assertTrue(strpos($result, "<td>Test</td>") !== false);
     $this->assertTrue(strpos($result, '<td align="center">1</td>') !== false);
     $adm = $this->getMock('ComicPressManagerAdmin', array('edit_config', 'get_backup_files'));
     $adm->expects($this->never())->method('edit_config');
     $adm->expects($this->once())->method('get_backup_files')->will($this->returnValue(array('12345')));
     $comicpress_manager = $this->getMock('ComicPressManager', array('get_subcomic_directory'));
     $comicpress_manager->errors = array('test');
     $comicpress_manager->show_config_editor = false;
     $comicpress_manager->can_write_config = true;
     $comicpress_manager->config_method = "comicpress-config.php";
     ob_start();
     $this->assertFalse($adm->handle_warnings());
     $result = ob_get_clean();
     $this->assertFalse(strpos($result, "You won't be able") !== false);
     $this->assertTrue(strpos($result, "Some backup") !== false);
     $this->assertTrue(strpos($result, '<option value="12345">') !== false);
     $this->assertTrue(strpos($result, "Debug info") !== false);
 }
コード例 #17
0
ファイル: htmly.php プロジェクト: robihidayat/htmly
        header("location: {$login}");
    }
});
// Submitted add category
post('/add/category', function () {
    $proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
    $title = from($_REQUEST, 'title');
    $url = from($_REQUEST, 'url');
    $content = from($_REQUEST, 'content');
    $description = from($_REQUEST, 'description');
    if ($proper && !empty($title) && !empty($content) && login()) {
        if (!empty($url)) {
            add_category($title, $url, $content, $description);
        } else {
            $url = $title;
            add_category($title, $url, $content, $description);
        }
    } else {
        $message['error'] = '';
        if (empty($title)) {
            $message['error'] .= '<li>Title field is required.</li>';
        }
        if (empty($content)) {
            $message['error'] .= '<li>Content field is required.</li>';
        }
        if (!$proper) {
            $message['error'] .= '<li>CSRF Token not correct.</li>';
        }
        config('views.root', 'system/admin/views');
        render('add-page', array('title' => 'Add page - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'error' => '<ul>' . $message['error'] . '</ul>', 'postTitle' => $title, 'postUrl' => $url, 'postContent' => $content, 'type' => 'is_category', 'bodyclass' => 'addcategory', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add page'));
    }
コード例 #18
0
    /* This person can't manage the knowledgebase, but can read it */
    header('Location: knowledgebase_private.php');
    exit;
}
/* Is Knowledgebase enabled? */
if (!$hesk_settings['kb_enable']) {
    hesk_error($hesklang['kbdis']);
}
/* This will tell the header to include WYSIWYG editor Javascript */
define('WYSIWYG', 1);
/* What should we do? */
if ($action = hesk_REQUEST('a')) {
    if ($action == 'add_article') {
        add_article();
    } elseif ($action == 'add_category') {
        add_category();
    } elseif ($action == 'manage_cat') {
        manage_category();
    } elseif ($action == 'edit_article') {
        edit_article();
    } elseif ($action == 'import_article') {
        import_article();
    } elseif ($action == 'list_private') {
        list_private();
    } elseif ($action == 'list_draft') {
        list_draft();
    } elseif (defined('HESK_DEMO')) {
        hesk_process_messages($hesklang['ddemo'], 'manage_knowledgebase.php', 'NOTICE');
    } elseif ($action == 'new_article') {
        new_article();
    } elseif ($action == 'new_category') {
コード例 #19
0
ファイル: index.php プロジェクト: smith-jordan/CIT360
     } else {
         add_product($category_id, $code, $name, $price);
         header('Location: .?action=list_products');
     }
 } else {
     if ($action == 'list_categories') {
         $categories = get_categories();
         include "category_list.php";
     } else {
         if ($action == 'add_category') {
             $category_name = filter_input(INPUT_POST, 'name');
             if ($category_name == NULL) {
                 $error = "Missing or incorrect category name.";
                 include '../errors/error.php';
             } else {
                 add_category($category_name);
                 header('Location: .?action=list_categories');
             }
         } else {
             if ($action == 'delete_category') {
                 $category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT);
                 if ($category_id == NULL || $category_id == FALSE) {
                     $error = "Missing or incorrect product id or category id.";
                     include '../errors/error.php';
                 } else {
                     delete_category($category_id);
                     header('Location: .?action=list_categories');
                 }
             } else {
                 if ($action == 'edit_product') {
                     $product_id = filter_input(INPUT_POST, 'product_id', FILTER_VALIDATE_INT);
コード例 #20
0
ファイル: merlion_db.php プロジェクト: systemo-biz/merlion
function set_main_information($item, $item_id)
{
    set_meta($item_id, $item->No);
    //update_post_meta($item_id, '_last_time_modified',$item->Last_time_modified);
    wp_set_object_terms($item_id, $item->Brand, 'product_brand');
    add_category($item_id, $item->GroupCode1);
    add_category($item_id, $item->GroupCode2);
    add_category($item_id, $item->GroupCode3);
}
コード例 #21
0
 /**
  * @dataProvider providerTestCategoryTraversal
  */
 function testCategoryTraversal($methods, $expected_result, $compare_ids = false)
 {
     global $post;
     $storyline = new ComicPressStoryline();
     $storyline->set_flattened_storyline('0/1,0/2,0/2/3,0/2/4,0/5');
     foreach (array(1 => array('cat_name' => 'Test 1', 'category_nicename' => 'category-1', 'category_parent' => 0), 2 => array('cat_name' => 'Test 2', 'category_nicename' => 'category-2', 'category_parent' => 0), 3 => array('cat_name' => 'Test 3', 'category_nicename' => 'category-3', 'category_parent' => 2), 4 => array('cat_name' => 'Test 4', 'category_nicename' => 'category-4', 'category_parent' => 2), 5 => array('cat_name' => 'Test 5', 'category_nicename' => 'category-5', 'category_parent' => 0)) as $id => $category) {
         add_category($id, (object) $category);
     }
     $post = (object) array('ID' => 1);
     $dbi = $this->getMock('ComicPressDBInterface');
     $core = new ComicPressTagBuilderFactory($dbi);
     wp_insert_post($post);
     wp_insert_post((object) array('ID' => 2));
     wp_set_post_categories(1, array(2));
     wp_set_post_categories(2, array(3));
     foreach ($methods as $method_info) {
         $method = array_shift($method_info);
         $core = call_user_func_array(array($core, $method), $method_info);
     }
     if (is_object($core)) {
         $this->assertEquals($expected_result, $core->cat_ID);
     } else {
         if (is_array($core) && $compare_ids) {
             foreach ($expected_result as $id) {
                 $cat = array_shift($core);
                 $this->assertEquals($id, $cat->cat_ID);
             }
         } else {
             $this->assertEquals($expected_result, $core);
         }
     }
 }
コード例 #22
0
            content_delete($pid, $ok);
            break;
        case "content_review":
            content_review($title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active);
            break;
        case "content_save":
            content_save($title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid);
            break;
        case "content_save_edit":
            content_save_edit($pid, $title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid);
            break;
        case "content_change_status":
            content_change_status($pid, $active);
            break;
        case "add_category":
            add_category($cat_title, $description);
            break;
        case "edit_category":
            edit_category($cid);
            break;
        case "save_category":
            save_category($cid, $cat_title, $description);
            break;
        case "del_content_cat":
            del_content_cat($cid, $ok);
            break;
    }
} else {
    include "header.php";
    GraphicAdmin();
    OpenTable();
コード例 #23
0
 $form_add_product->add('Text', 'product_portion')->label('Nombre de portions par produit');
 $form_add_product->add('Text', 'product_price')->label('Prix du produit');
 $form_add_product->add('Text', 'product_img')->label('Image du produit');
 $form_add_product->add('Text', 'product_health_pt')->label('Point de santé du produit');
 $form_add_product->add('Text', 'product_angry_pt')->label('Point de faim du produit');
 $form_add_product->add('Text', 'product_thirst_pt')->label('Point de soif du produit');
 $form_add_product->add('Submit', 'submit')->value('Valider');
 //Errors array
 $errors_form_cat = array();
 $errors_form_product = array();
 $msg_confirm = array();
 if ($form_add_cat->is_valid($_POST)) {
     list($cat_name, $cat_desc, $cat_img) = $form_add_cat->get_cleaned_data('cat_name', 'cat_description', 'cat_image');
     //want to add a category
     if (!empty($cat_name) && !empty($cat_desc) && !empty($cat_img)) {
         $test = add_category($cat_name, $cat_desc, $cat_img);
         if ($test == true) {
             $msg_confirm[] = "Votre catégorie a bien était ajoutée.";
         } else {
             $error =& $test;
             if (23000 == $error[0]) {
                 // Le code d'erreur 23000 signifie "doublon" dans le standard ANSI SQL
                 preg_match("`Duplicate entry '(.+)' for key \\d+`is", $error[2], $value_pb);
                 $value_pb = $value_pb[1];
                 if ($email_addr == $value_pb) {
                     $errors_form_cat[] = "Cette catégorie existe déjà.";
                 } else {
                     $errors_form_cat[] = "Erreur ajout SQL : doublon non identifié présent dans la base de données.";
                 }
             } else {
                 $errors_form_cat[] = sprintf("Cette catégorie existe déjà.");
コード例 #24
0
 /**
  * @dataProvider providerTestNormalizeCategoryGroupings
  */
 function testNormalizeCategoryGroupings($grouping, $valid_categories, $expected_grouping)
 {
     $comicpress = ComicPress::get_instance();
     if (!is_null($grouping)) {
         $comicpress->comicpress_options['category_groupings'] = $grouping;
     } else {
         unset($comicpress->comicpress_options['category_groupings']);
     }
     foreach ($valid_categories as $category_id) {
         add_category($category_id, (object) array('slug' => "test-{$category_id}"));
     }
     $this->css->normalize_category_groupings();
     $this->assertEquals($expected_grouping, $comicpress->comicpress_options['category_groupings']);
 }
コード例 #25
0
 function testGetCategorySimpleStructure()
 {
     add_category(1, (object) array('parent' => 0));
     add_category(2, (object) array('parent' => 1));
     add_category(3, (object) array('parent' => 2));
     add_category(4, (object) array('parent' => 2));
     $this->assertEquals(array('0' => array('1' => array('2' => array('3' => true, '4' => true)))), $this->css->get_category_simple_structure(1));
 }
コード例 #26
0
//            $content = "log-reports.php";
//        }else if($page == 'users-list'){
//            $content = "users-list.php";
//        }
//    }else{
//        $content = "main-dashboard.php";
//    }
//    print_r($_POST);
if (isset($_POST['save'])) {
    include_once 'functions/database.php';
    if (isset($_POST['category_id'])) {
        echo "wews";
        $flag = add_subcategory($_POST);
    } else {
        echo "wew";
        $flag = add_category($_POST);
    }
}
?>

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
コード例 #27
0
ファイル: categories.php プロジェクト: adriculous/enthusiast
require_once 'mod_errorlogs.php';
require_once 'mod_settings.php';
require_once 'mod_categories.php';
$show_default = true;
$action = '';
if (isset($_REQUEST['action'])) {
    $action = $_REQUEST['action'];
}
echo '<h1>Manage Collective Categories</h1>';
/*______________________________________________________________________ADD__*/
if ($action == 'add') {
    $show_default = false;
    $show_form = true;
    if (isset($_POST['done']) && $_POST['done'] == 'yes') {
        if (isset($_POST['catname']) && $_POST['catname'] != '') {
            $success = add_category($_POST['catname'], $_POST['parent']);
            if ($success) {
                echo '<p class="success">Category <i>' . $_POST['catname'] . '</i> added.</p>';
                $show_form = false;
                $show_default = true;
            } else {
                echo '<p class="error">Error adding category. ' . 'Please try again.</p>';
            }
        }
    }
    if ($show_form) {
        ?>
      <p>
      To add a category, select the parent category (if applicable)
      from the dropdown, enter the category name, and click
      "Add this Category".
コード例 #28
0
ファイル: category.php プロジェクト: kagoji/liveproduct
<?php 
include 'template/header.php';
include 'template/menu.php';
?>


<?php 
/*************************category Insert***********************/
if (!empty($_POST['submit'])) {
    $insert_category = add_category($_POST['category_name'], $_POST['category_code_slug']);
    if ($insert_category == 1) {
        $message = "Category has been added.";
    } else {
        $errormessage = "Something wrong. Please Try Again!!";
    }
}
/*************************end category Insert***********************/
$all_category = all_category();
//show all category
/**************************Category delete***********************/
if (!empty($_GET['delete'])) {
    $delete_category = delete_category($_GET['delete']);
    if ($delete_category == 1) {
        header('Location:category.php');
    } else {
        $errormessage = "Something wrong. Please try again!!.";
    }
}
/**************************Category delete***********************/
?>
コード例 #29
0
     $categories = get_categories();
     include 'category_list.php';
     break;
 case 'delete_category':
     $category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT);
     delete_category($category_id);
     header("Location: .");
     break;
 case 'add_category':
     $name = filter_input(INPUT_POST, 'name');
     // Validate inputs
     if (empty($name)) {
         display_error('You must include a name for the category.
                        Please try again.');
     } else {
         $category_id = add_category($name);
     }
     header("Location: .");
     break;
 case 'update_category':
     $category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT);
     $name = filter_input(INPUT_POST, 'name');
     // Validate inputs
     if (empty($name)) {
         display_error('You must include a name for the category.
                       Please try again.');
     } else {
         update_category($category_id, $name);
     }
     header("Location: .");
     break;
コード例 #30
0
        $error = "You must submit a category name.";
    } else {
        if (category_exits("name", $name)) {
            $error = "Thats category already exits.";
        } else {
            if (strlen($name) > 24) {
                $error = "Category names can only be upto 24 characters.";
            } else {
                if (!ctype_alpha($name)) {
                    $error = "Category names should be characters only.";
                }
            }
        }
    }
    if (!isset($error)) {
        add_category($name);
        Header("Location: add_post.php");
        die;
    }
}
?>
<html>
	<head>
	    <meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="bootstrap.min.css">
	    <title>Add a category</title>
	</head>
	
		<body>
			<div class="container-fluid">