public function testContentCategories() { $params = array('title' => 'My categories page', 'content_type' => 'page', 'subtype' => 'dynamic', 'is_active' => 1); //saving $parent_page_id = save_content($params); $parent_page_data = get_content_by_id($parent_page_id); $params = array('title' => 'Test Category 1', 'parent_page' => $parent_page_id); //saving $category_id = save_category($params); $category_data = get_category_by_id($category_id); $category_page = get_page_for_category($category_data['id']); $delete_category = delete_category($category_id); $delete_page = delete_content($parent_page_id); $deleted_page = get_content_by_id($parent_page_id); $params = array('title' => 'Test Category with invalid position', 'position' => 'uga buga'); $category_with_invalid_pos = save_category($params); //PHPUnit $this->assertEquals(true, intval($parent_page_id) > 0); $this->assertEquals(true, intval($category_id) > 0); $this->assertEquals(true, is_array($category_data)); $this->assertEquals(true, is_array($category_page)); $this->assertEquals($category_page['title'], $parent_page_data['title']); $this->assertEquals(true, $delete_category); $this->assertEquals(false, $deleted_page); $this->assertEquals(true, intval($category_with_invalid_pos) > 0); $this->assertEquals(true, is_array($delete_page)); }
if (empty($errors)) { if ($_POST['show_preview'] == 'true') { $smarty->assign('show_preview', true); } else { escape($_POST, array('description')); $data = array('company' => $company, 'url' => $url, 'title' => $title, 'summary' => $summary, 'city_id' => $city_id, 'category_id' => $category_id, 'type_id' => $type_id, 'description' => $description, 'location_outside_ro_where' => $isCitySelected ? '' : $location_outside_ro_where, 'apply' => '', 'poster_email' => $poster_email, 'apply_online' => $apply_online); if ($id != 0) { $job->Edit($data); } else { // a job posted by the admin is active from the beginning $data['is_temp'] = 0; $data['is_active'] = 1; $data['spotlight'] = 0; if ($jobId = $job->Create($data)) { Subscriber::sendJob($jobId); } } $category = get_category_by_id($category_id); redirect_to(BASE_URL . URL_JOBS . '/' . $category['var_name'] . '/'); exit; } } else { $smarty->assign('errors', $errors); } } $smarty->assign('job', $jobToEdit); $smarty->assign('categories', get_categories()); $smarty->assign('types', get_types()); $smarty->assign('cities', get_cities()); $html_title = $translations['jobs']['title_edit'] . ' / ' . SITE_NAME; $template = 'edit-post.tpl';
?> <?php $cont = get_content_by_id($data["content_id"]); if (isset($cont['title'])) { $data['title'] = $cont['title']; $item_url = content_link($cont['id']); } ?> <?php } else { ?> <?php if ((!isset($data['title']) or $data['title'] == '') and isset($data["categories_id"]) and intval($data["categories_id"]) > 0) { ?> <?php $cont = get_category_by_id($data["categories_id"]); if (isset($cont['title'])) { $data['title'] = $cont['title']; $item_url = category_link($cont['id']); } ?> <?php } ?> <?php } ?> <?php if (isset($data['content_id']) and intval($data['content_id']) != 0) { $item_url = content_link($data['content_id']); }
function new_directive_id($cat_id) { $category = get_category_by_id($cat_id); $init = $category->mini; $max = $category->maxi; $XML_FILE = "/etc/ossim/server/" . $category->xml_file; /* init_file($XML_FILE); if (!$dom = domxml_open_file($XML_FILE, DOMXML_LOAD_SUBSTITUTE_ENTITIES)) { echo _("Error while parsing the document")."\n"; exit; } $table = $dom->get_elements_by_tagname('directive'); if (count($table) == 0) { $ind = $init; } else { $i = $init; $find = FALSE; while (($i < $max) && ($find == FALSE)) { $find = TRUE; $j = 0; while (($j < count($table)) && ($find == TRUE)) { $id = $table[$j]->get_attribute('id'); if (strcmp($i, $id) == 0) { $find = FALSE; } $j++; } $ind = $i; $i++; } } release_file($XML_FILE); */ $lines = file($XML_FILE); $ids = array(); $ind = 0; foreach ($lines as $line) { if (preg_match("/directive id\\=\"(\\d+)\"/", $line, $found)) { $ids[] = $found[1]; } } sort($ids); foreach ($ids as $id) { if ($ind == 0) { $ind = $id; } elseif ($id == $ind + 1) { $ind = $id; } } return $ind > 0 ? $ind + 1 : $init; }
<?php only_admin_access(); $form_rand_id = uniqid() . rand(); $data = false; if (isset($params["data-category-id"])) { $data = get_category_by_id($params["data-category-id"]); } if ($data == false or empty($data)) { include '_empty_category_data.php'; } $just_saved = false; $quick_edit = false; if (isset($params['just-saved'])) { $just_saved = $params['just-saved']; } if (isset($params['quick_edit'])) { $quick_edit = $params['quick_edit']; } $wrapper_class = 'mw-edit-category-item-admin'; if (isset($params['live_edit'])) { $wrapper_class = 'module-live-edit-settings'; } ?> <div class="<?php print $wrapper_class; ?> "> <script type="text/javascript"> mw.require('forms.js');
*/ require_once 'classes/Session.inc'; Session::logcheck("MenuIntelligence", "CorrelationDirectives"); require_once 'ossim_conf.inc'; require_once 'classes/Security.inc'; /* directories */ $conf = $GLOBALS["CONF"]; $base_dir = $conf->get_conf("base_dir"); $css_dir = '../../style'; $js_dir = '../javascript'; $js_dir_category = 'javascript'; /* connection to the OSSIM database */ require_once '../../include/directive.php'; dbConnect(); /* get the category */ $category = get_category_by_id($_GET['id']); if (!isset($category)) { $category = new Category(NULL, NULL, NULL, NULL); } $_SESSION['category'] = serialize($category); /* width */ $xml_file_width = '300px'; $mini_width = '100px'; $maxi_width = '100px'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head>
<?php if (!empty($_POST) && isset($_POST['email']) && isset($_POST['category'])) { if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $email = $db->real_escape_string($_POST['email']); $category = $db->real_escape_string($_POST['category']); if ($category != '0') { $categoryData = get_category_by_id($category); if (is_null($categoryData)) { echo '0'; exit; } } $subscriber = new Subscriber($email); $postman = new Postman(); if ($subscriber->addSubscription($category)) { if ($postman->MailSubscriptionPleaseConfirm($email, $subscriber->getAuthCode())) { echo '1'; exit; } } } echo '0'; exit; } else { if ($settings['subscribe_page_content'] != '') { $sql = ' SELECT * FROM ' . DB_PREFIX . 'pages WHERE url = "' . $db->real_escape_string($settings['subscribe_page_content']) . '"'; $result = $db->query($sql);
$type = 'page'; } ?> <h2><span class="mw-icon-<?php print $type; ?> "></span><?php print $page_info['title']; ?> </h2> <?php } elseif (isset($params['category-id'])) { ?> <?php $cat = get_category_by_id($params['category-id']); ?> <?php if (isset($cat['title'])) { ?> <h2><span class="mw-icon-category"></span> <?php print $cat['title']; ?> </h2> <?php } ?> <?php } elseif ($act == 'pages') { ?> <h2><span class="mw-icon-website"></span>
$thumbnail = "images/thumbnails/" . $episode["EpID"] . ".jpg"; $info_box .= "<img src=\""; file_exists($thumbnail) ? $info_box .= $thumbnail : ($info_box .= "images/thumbnails/default.jpg"); $info_box .= "\">"; $info_box .= "</div>"; $info_box .= "<div id=\"cms_episode_search_data_name\">"; if (strlen($episode["EpName"]) > 30) { $info_box .= substr($episode["EpName"], 0, 30) . "..."; } else { $info_box .= $episode["EpName"]; } $info_box .= "</div>"; $info_box .= "</div>"; $info_box .= "<div id=\"cms_info_panel\"> "; $info_box .= "<ul>"; $info_box .= "<li><span id=\"episode_info_name\">ID:</span> " . $episode["EpID"] . "</li>"; $category1 = get_category_by_id($episode["Category1"]); $info_box .= "<li><span id=\"episode_info_name\">Category1:</span> " . ucfirst($category1["name"]) . "</li>"; $category2 = get_category_by_id($episode["Category2"]); $info_box .= "<li><span id=\"episode_info_name\">Category2:</span> "; $category2 == null ? $info_box .= "None" : ($info_box .= ucfirst($category2["name"])); $info_box .= "</li>"; $info_box .= "<li><span id=\"episode_info_name\">Episode No.: </span> " . $episode["EpNum"] . "</li>"; $info_box .= "<li><span id=\"episode_info_name\">Season:</span>" . $episode["Season"] . "</li>"; $info_box .= "<li><span id=\"episode_info_name\">Video Link:</span> "; $info_box .= "<a href=\"" . $episode["VidLink"] . "\"> Watch </li>"; $info_box .= "</ul>"; $info_box .= "</div>"; $info_box .= "</div>"; $info_box .= "</td>"; echo $info_box;
<?php $job = new Job($id); if ($job->Exists() && $extra != '' && $extra == $job->GetAuth()) { $info = $job->GetInfo(); $url = BASE_URL . URL_JOB . '/' . $id . '/' . $info['url_title'] . '/'; $app = new JobApplication($id); $apps_count = $app->Count(); $info['applied_count'] = $apps_count; $smarty->assign('count_applicants', $apps_count); $smarty->assign('job', $info); $category = get_category_by_id($info['category_id']); // set paginator link $paginatorLink = BASE_URL . 'view-applicants/' . $id . '/' . $extra . '/'; $paginator = new Paginator($apps_count, JOBS_PER_PAGE, @$_REQUEST['p']); $paginator->setLink($paginatorLink); $paginator->paginate(); $from = $paginator->getFirstLimit(); $to = $paginator->getLastLimit(); // grab all jobs applied $the_applicants = $app->getAllForJob($from, JOBS_PER_PAGE); $smarty->assign('applicants', $the_applicants); // send page links to template $smarty->assign('pages', $paginator->pages_link); $smarty->assign('seo_title', $translator->translate("jobs.html_title", stripslashes($info['title']), stripslashes($info['company']), SITE_NAME)); $smarty->assign('cv_path', BASE_URL . FILE_UPLOAD_DIR); $smarty->assign('current_category', $category['var_name']); $smarty->assign('back_link', BASE_URL . 'manage/' . $id . '/' . $extra . '/'); $template = 'job-applications.tpl'; } else { redirect_to(BASE_URL . URL_JOB . '/' . $id . '/');
<div style="float:right;width:79%;"> <?php include 'header.php'; //echo "Accion: ".$accion.", Logado: ".$logado.", Userid: ".isset($_SESSION['userid']).", Password: "******"<br>"; ?> <div style="font-size: 21px; font-weight: bold; margin-top: 5px;">Nominaciones previas por categoría:</div> <div class="awardsubheader oscars_anteriores"> <?php //echo "Acción: ".$accion."(".$sql."), ".$filas_correctas." filas correctas. (".$error[2].")"; if ($logado) { //echo "<div class='titulo_categoria'>Mejor director</div>"; //show_director_nominations($year, 2, $bd); //$x=get_oscars_by_actor('0000217',$bd); //echo "<textarea>".$x[0]."</textarea>"; //print_r(get_oscars_by_actor('0000217',$bd)); for ($c_id = 3; $c_id <= 6; $c_id++) { echo "<div class='titulo_categoria'>" . get_category_by_id($bd, $c_id) . "</div>"; show_actor_nominations($year, $c_id, $bd); } for ($c_id = 7; $c_id <= 10; $c_id++) { echo "<div class='titulo_categoria'>" . get_category_by_id($bd, $c_id) . "</div>"; show_person_nominations($year, $c_id, $bd); } } else { echo "No ha iniciado sesión para consultar la página."; } ?> </div> </div> </body> </html>
function make_episode_cell($id, $html_under_cell = "") { $episode = get_episode_by_id($id); if ($episode == null) { die("Episode not found."); } $output = ""; $url = "video.php?e=" . $id; $output .= "<li>"; $output .= "<div class=\"video_item\">"; $output .= "<a href=\"" . $url . "\">"; $thumbnail = "images/thumbnails/" . $episode["EpID"] . ".jpg"; $output .= "<img src=\""; file_exists($thumbnail) ? $output .= $thumbnail : ($output .= "images/thumbnails/default.jpg"); $output .= "\">"; $output .= "</a>"; $output .= "<a class=\"episode_name_link\" href=\"" . $url . "\">"; $output .= "<div class=\"episode_name\"> " . $episode["EpName"] . " </div> "; $output .= "</a>"; $output .= "<div class=\"category_link_wrapper\">"; $output .= "Category: "; $category1_url = "category.php?category=" . $episode["Category1"]; $category1_name = get_category_by_id($episode["Category1"])["name"]; $output .= "<a class=\"category_link\" href=\"" . $category1_url . "\">" . ucfirst($category1_name) . "</a>"; $output .= "<script>console.log( " . $episode["Category2"] . " ) </script> "; if ($episode["Category2"] != "0") { $output .= ", "; $category2_url = "category.php?category=" . $episode["Category2"]; $category2_name = get_category_by_id($episode["Category2"])["name"]; $output .= "<a class=\"category_link\" href=\"" . $category2_url . "\">" . ucfirst($category2_name) . "</a>"; } $output .= "</div>"; $output .= "<div> Season " . $episode["Season"] . " , Episode " . $episode["EpNum"] . " </div>"; $output .= "</div>"; $output .= $html_under_cell; $output .= "</li>"; return $output; }
function new_directive_id($cat_id) { $category = get_category_by_id($cat_id); $init = $category->mini; $max = $category->maxi; $XML_FILE = "/etc/ossim/server/" . $category->xml_file; init_file($XML_FILE); if (!($dom = domxml_open_file($XML_FILE, DOMXML_LOAD_SUBSTITUTE_ENTITIES))) { echo _("Error while parsing the document") . "\n"; exit; } $table = $dom->get_elements_by_tagname('directive'); if (count($table) == 0) { $ind = $init; } else { $i = $init; $find = FALSE; while ($i < $max && $find == FALSE) { $find = TRUE; $j = 0; while ($j < count($table) && $find == TRUE) { $id = $table[$j]->get_attribute('id'); if (strcmp($i, $id) == 0) { $find = FALSE; } $j++; } $ind = $i; $i++; } } release_file($XML_FILE); return $ind; }
<?php category_navigation(); ?> </div> <div class="panel" > <a href="mailto:sevenchild@hotlinetohellgirl.com">Contact me</a> if any links are broken. </div> </div> <div class="large-10 columns"> <div class="panel"> <?php if ($has_category) { $name = get_category_by_id($_GET["category"])["name"]; echo "<h2>" . ucfirst($name) . "</h2> "; echo "<div id=\"category_search_data\"> "; include "load_search_data.php"; echo "</div> "; echo "<script src=\"javascripts/vendor/jquery.js\"></script>"; echo "<script src=\"javascripts/search_functions.js\"> </script>"; echo "<script> make_pages(\"#category_search_data\"); </script>"; } else { echo "<h2>Category</h2> "; echo "Select a category to the left. "; } ?> </div> </div> </div>
<?php /* type: layout name: Dropdown description: Dropdown skin */ $params['ul_class'] = ''; $params['ul_class_deep'] = ' '; $val = 'Select'; $cat = get_category_by_id(CATEGORY_ID); if ($cat != false) { $val = $cat['title']; } ?> <div class="mw-dropdown mw-dropdown-default w100 categories-dropdown" style="width: 200px;"> <span class="mw-dropdown-value mw-ui-btn mw-ui-btn-big mw-dropdown-val"><?php print $val; ?> </span> <div class="mw-dropdown-content"> <?php category_tree($params); ?> </div> </div>
<?php $output = "<a href=\""; $output .= "search.php?season=" . $episode["Season"] . "\">"; $output .= $episode["Season"] . "</a> "; echo $output; ?> Category: <?php $category1_url = "category.php?category=" . $episode["Category1"]; $category1_name = get_category_by_id($episode["Category1"])["name"]; $output = " <a class=\"category_link\" href=\"" . $category1_url . "\">" . ucfirst($category1_name) . "</a>"; $output .= "<script>console.log( " . $episode["Category2"] . " ) </script> "; if ($episode["Category2"] != "0") { $output .= ", "; $category2_url = "category.php?category=" . $episode["Category2"]; $category2_name = get_category_by_id($episode["Category2"])["name"]; $output .= "<a class=\"category_link\" href=\"" . $category2_url . "\">" . ucfirst($category2_name) . "</a>"; } echo $output; ?> </span> <!-- javascript data attributes are blowing my mind --> <span data-user-id="<?php if (isset($_SESSION["user_id"])) { echo $_SESSION["user_id"]; } else { echo "-1"; // we will say please log in if we get this } ?> "