break; case 'tienda': require_once "PHP/contenido.php"; CONTENIDO_TIENDA(); break; case 'perfil': require_once "PHP/perfil.php"; CONTENIDO_PERFIL(); break; case 'vip': require_once "PHP/contenido.php"; CONTENIDO_VIP(); break; case 'rss': require_once "anunciadores.php"; RSS(); break; case 'registro_usuarios_correo': if (isset($_GET['op'])) { $email = db_codex(trim($_GET['op'])); if ($email) { echo _F_usuario_existe($email, "email") ? "este correo ya esta registrado" : ""; } } break; case 'registro_usuarios_usuario': if (isset($_GET['op'])) { $usuario = db_codex(trim($_GET['op'])); if ($usuario) { echo _F_usuario_existe($usuario) ? "este nombre de usuario ya esta registrado" : ""; }
function K_MEANS($processed_array) { global $iterations; global $centroids; global $clusters; //this variable ($previous_RSS_value) is compared to the RSS value before it //if the new RSS value is not less than the previous one, //convergence has occured and so I leave the loop before //the rest of the iterations take place //I chose '1M' to be extra safe as the first RSS value should always //be lower than this number to work $previous_RSS_value = 1000000; for ($temp_index = 0; $temp_index < $iterations; $temp_index++) { //echo '<br><br>ITERATION '.$temp_index.'<br><br>'; $closest_cluster = 0; //initialize foreach ($processed_array as $doc) { if (in_array($doc["tf_idf"], $centroids) and $temp_index == 0) { continue; } $temp_dist = 0; //distance calculated to each centroid foreach ($centroids as $centroid_key => $val) { $product = 0; foreach ($val as $key2 => $number) { $product = $product + $val[$key2] * $doc["tf_idf"][$key2]; } if ($product > $temp_dist) { $temp_dist = $product; $closest_cluster = $centroid_key; } } array_push($clusters[$closest_cluster], $doc); } //get new RSS value $RSS = RSS(); //echo '<br><br>RSS = '.$RSS.'<br><br>'; if ($RSS == $previous_RSS_value) { //convergence has occured //echo '<br><br>CONVERGENCE at '.$temp_index.'<br><br>'; break; } else { //else, update previous RSS value $previous_RSS_value = $RSS; } RE_CALCULATE_CENTROIDS($temp_index); } }
function cal($month, $year) { global $CAT_TB, $EVENTS_TB, $USER_TB, $mth, $week, $language, $m, $d, $y, $viewcalok, $viewweekok, $viewdayok, $searchmonthok, $popupevent, $popupeventwidth, $popupeventheight, $calstartyear, $caladvanceyear, $allowsearch, $weekstartday, $addeventok, $userview, $userlogin, $userid, $addeventwin_w, $addeventwin_h, $catview, $uname, $ugroup, $showuserentry, $publicview, $limitmthevt, $notimeentry, $overlibbgclr, $rssfeeds, $rssactive, $rssview; if (isset($rssview)) { $rsschannel = $rssfeeds[$rssview][0]; } else { $rsschannel = "None"; } if ($viewcalok == 1) { // previous month $pm = $month; if ($month == "1") { $pm = "12"; } else { $pm--; } // previous year $py = $year; if ($pm == "12") { $py--; } // next month $nm = $month; if ($month == "12") { $nm = "1"; } else { $nm++; } // next year $ny = $year; if ($nm == 1) { $ny++; } // get month we want to see $askedmonth = $mth[$month]; $askedyear = $year; $firstday = date("w", mktime(12, 0, 0, $month, 1, $year)); $firstday; // Check RSS Feed if ($rssactive == 1) { $RSSData = RSS(1, 1, 2007); } // number of days in askedmonth $nr = date("t", mktime(12, 0, 0, $month, 1, $year)); echo "\n\n<table class=monthview align=center>"; echo "<tr>"; echo "<td align=left colspan=2 class=monthview width='28%' valign=middle> "; if ($year > $calstartyear || $month > 1 && $year == $calstartyear) { echo "<a href=calendar.php?op=cal&month=" . $pm . "&year=" . $py . "&catview={$catview} class=calfontnav>" . $mth[$pm] . " " . $py . "</a>"; $pdate = date("Y-m-d", mktime(0, 0, 0, $month - 1, 1, $year)); echo " <a href='Javascript:void(0);' onclick=\"Javascript:wopen('smallcal.php?op=smallcal&date={$pdate}','popupmonth',350,220,'no');\">"; echo "<img src='images/smallcal.gif' border=0 alt='" . translate("Popup Month") . "' valign=middle width=16 height=16/></a>"; } else { echo " "; } echo "</td>"; echo "<td align=center colspan=3 class=monthview width='44%' >"; echo "<div class=calfontasked>" . $askedmonth . " "; echo " <a href='Javascript:void(0);' onclick=\"Javascript:wopen('yearcal.php?op=yearcal&ycyear={$askedyear}','popupyear',610,600,'yes');\" class=calfontasked>"; echo $askedyear . "</a></div>\n"; echo "<td align=right colspan=2 class=monthview width='28%'>"; $calendyear = $y + $caladvanceyear; if ($ny <= $calendyear) { $ndate = date("Y-m-d", mktime(0, 0, 0, $month + 1, 1, $year)); echo " <a href='Javascript:void(0);' onclick=\"Javascript:wopen('smallcal.php?op=smallcal&date={$ndate}','popupmonth',350,220,'no');\">"; echo "<img src='images/smallcal.gif' border=0 alt='" . translate("Popup Month") . "' valign=middle width=16 height=16/></a> "; echo "<a href=calendar.php?op=cal&month=" . $nm . "&year=" . $ny . "&catview={$catview} class=calfontnav>" . $mth[$nm] . " " . $ny . "</a>"; echo " "; } else { echo " "; } echo "</td></tr></table>\n\n"; echo "<table align=center class=monthview cellspacing=1>"; echo "<tr>"; // make the header days of week for ($i = intval($weekstartday) + 1; $i <= intval($weekstartday) + 7; $i++) { echo "<td align=center "; if (dayinweek($i) == 1) { echo "class=sundaytopcolor><div class=dayfont>" . $week[dayinweek($i)] . "</div></td>\n"; } else { echo "class=weekdaytopcolor><div class=dayfont>" . $week[dayinweek($i)] . "</div></td>\n"; } // rest of week } echo "</tr>\n\n<tr>\n"; // begin the days // print initial blank squares for ($i = 1; $i <= blankdays(intval($weekstartday), $firstday); $i++) { echo "<td "; if (dayinweek($i) == 1) { echo "class=sundayemptyclr "; } else { echo "class=weekdayemptyclr "; } echo "> </td>"; } $a = 0; for ($i = 1; $i <= $nr; $i++) { echo "<td "; if ($i == $d && $month == $m && $year == $y) { // highlight today's day echo "class=todayclr "; } else { if (date("w", mktime(0, 0, 0, $month, $i, $year)) == 0) { echo "class=sundayclr "; } else { echo "class=weekdayclr "; } } // click on date number to view events for the date echo " valign=top><table width='100%' border=0 cellspacing=1 cellpadding=1><tr><td align=left>"; echo "<b>"; if ($viewdayok == 1) { echo "<a class=datenumfont href='cal_day.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)) . "&catview={$catview}'>"; } echo $i; if ($viewdayok == 1) { echo "</a>"; } echo "</b></td>"; echo "<td align=right> "; if (date("w", mktime(0, 0, 0, $month, $i, $year)) == $weekstartday) { if ($viewweekok == 1) { echo "<a href='cal_week.php?op=week&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)) . "&catview={$catview}'><img src='images/week.gif' alt='" . translate("View week") . " " . weekNumber($i, $month, $year) . "' border=0 valign=middle width=11 height=11/></a> "; } } if ($publicview == 1 && $uname != "" || $publicview == 0) { if ($addeventok == 1) { echo "<a href='Javascript:void(0);' onclick=\"Javascript:wopen('cal_addevent.php?op=eventform&add_day={$i}&add_month={$month}&add_year={$year}&catview={$catview}','popupwin'," . $addeventwin_w . "," . $addeventwin_h . ",'yes');\"><img src='images/plus.gif' alt='" . translate("Add Event") . "' border=0 valign=middle width=11 height=11/></a>"; } } echo "</td></tr></table>"; // now get RSS events if ($rssactive == 1) { if (isset($RSSData[$i][$month][$year])) { echo "\n<table class=eventborder border=1 cellspacing=0 cellpadding=0 width=100%><tr><td align=center class=eventtimeborder valign=top>"; echo "\n<div class=smallcalev><b>"; // overlib line echo "<a href='Javascript:void(0);' onmouseover=\"return overlib('"; echo "<table border=0 cellspacing=0 cellpadding=0 width=100%>"; for ($j = 0; $j <= $RSSData[$i][$month][$year]['count']; $j++) { echo "<tr><td align=center valign=top>"; echo "<table class=eventborder border=1 cellspacing=0 cellpadding=0 width=100%><tr>"; if ($notimeentry == 0) { echo "<td align=center class=eventtimeborder valign=top>"; echo "<div class=smallcalevtime>"; if (isset($RSSData[$i][$month][$year][$j]['starttime'])) { if ($RSSData[$i][$month][$year][$j]['starttime'] == '') { echo " "; } else { showtime($RSSData[$i][$month][$year][$j]['starttime'], $RSSData[$i][$month][$year][$j]['endtime'], 1); } echo "</div>"; echo "</td>"; } } echo "<td align=left valign=top width=80% class=eventborder>"; echo "<div class=smallcalevtime>"; echo "<a class=smallcalev href=\\'" . $RSSData[$i][$month][$year][$j]['link'] . "\\' target=_BLANK>"; echo subquot(stripslashes($RSSData[$i][$month][$year][$j]['title'])); echo "</a>"; echo "</td></tr></table>"; echo "</td></tr>"; } echo "</table>"; // overlib line echo "',FGCOLOR,'{$overlibbgclr}',TEXTSIZE,'1',WIDTH,'125',VAUTO,HAUTO,STICKY,CAPTION,'"; echo $i . " " . $askedmonth . " ');\" onmouseout=\"return nd();\">"; echo "[" . $rsschannel . "]"; echo "</a>"; echo "</b></div>\n"; echo "</td></tr></table>"; } } // now get eventual events on $i $query = "select id,user,title,starttime,endtime from " . $EVENTS_TB . " left join " . $CAT_TB . " on " . $EVENTS_TB . ".cat=" . $CAT_TB . ".cat_id where day='{$i}' and month='{$month}' and year='{$year}' and approved='1' "; if ($catview != 0) { $query = $query . " and " . $EVENTS_TB . ".cat={$catview} "; } if ($userview == 1 && $userlogin == 1) { // user view user specific events only if ($ugroup != 0) { $query = $query . " and " . $EVENTS_TB . ".user='******' "; } } $query = $query . " order by day,month,year,starttime,title ASC"; $result = mysql_query($query); $devtcnt = mysql_num_rows($result); if ($limitmthevt != 0 && $devtcnt != 0 && $devtcnt >= $limitmthevt) { echo "\n<div class=smallcalev><b> ## "; // overlib line echo "<a href='cal_day.php?op=day&date=" . date("Y-m-d", mktime(0, 0, 0, $month, $i, $year)) . "&catview={$catview}' onmouseover=\"return overlib('"; echo "<table border=0 cellspacing=0 cellpadding=0 width=100%>"; while ($row = mysql_fetch_object($result)) { echo "<tr><td align=center valign=top>"; echo "<table class=eventborder border=1 cellspacing=0 cellpadding=0 width=100%><tr>"; if ($notimeentry == 0) { echo "<td align=center class=eventtimeborder valign=top>"; echo "<div class=smallcalevtime>"; if ($row->starttime == '') { echo " "; } else { showtime($row->starttime, $row->endtime, 1); } echo "</div>"; echo "</td>"; } echo "<td align=left valign=top width=80% class=eventborder>"; echo "<div class=smallcalev>"; // bug in overlib when putting hyperlink if ($popupevent == 1) { echo "<a class=smallcalev href=\\'Javascript:void(0);\\' onclick=\\'Javascript:popup(" . $row->id . ");\\'>"; } else { echo "<a class=smallcalev href=\\'cal_event.php?id=" . $row->id . "\\' >"; } echo subquot(stripslashes($row->title)); echo "</a>"; echo "</div>"; echo "</td></tr>"; echo "</table>"; echo "</td></tr>"; } echo "</table>"; // overlib line echo "',FGCOLOR,'{$overlibbgclr}',TEXTSIZE,'1',WIDTH,'125',VAUTO,HAUTO,STICKY,CAPTION,'"; echo $i . " " . $askedmonth . " ');\" onmouseout=\"return nd();\">"; echo $devtcnt . " " . translate("events"); echo "</a>"; echo " ## </b></div>\n"; } else { if ($devtcnt != 0) { echo "\n<table border=0 cellspacing=0 cellpadding=0 width='100%'>"; while ($row = mysql_fetch_object($result)) { echo "<tr><td align=center valign=top>\n"; echo "<table class=eventborder border=1 cellspacing=0 cellpadding=0 width='100%'><tr>"; if ($notimeentry == 0) { echo "<td align=center class=eventtimeborder valign=top>"; echo "<div class=smallcalevtime>"; if ($row->starttime == '') { echo " "; } else { showtime($row->starttime, $row->endtime, 1); } echo "</td>"; } echo "<td align=left valign=top width='80%' class=eventborder>"; if ($showuserentry == 1 && $uname != "") { echo "<" . $row->user . "> "; } if ($popupevent == 1) { echo "<a class=smallcalev href=\"Javascript:void(0);\" onclick=\"Javascript:popup(" . $row->id . ");\">"; } else { echo "<a class=smallcalev href=cal_event.php?id=" . $row->id . ">"; } echo stripslashes($row->title) . "</a>"; echo "</td></tr>"; echo "</table>"; } echo "</table>\n"; } } echo "</td>"; $a++; if (blankdays(intval($weekstartday), date("w", mktime(0, 0, 0, $month, $i, $year))) == 6) { echo "</tr>\n\n<tr>"; $a = 0; } } // ending stuff (making 'white' td's to fill table if ($a != 0) { $last = 7 - $a; for ($i = 1; $i <= $last; $i++) { echo "<td class=weekdayemptyclr> </td>"; } } echo "</tr>"; echo "</table>"; echo "<table width='100%' align=center border=0 cellspacing=1 cellpadding=0>"; echo "<tr><td align=center width='30%' valign=top>"; echo "<table class=txtbox width=70 align=left cellpadding=2 cellspacing=0><tr><td align=center class=todayclr><i><div class=normalfont>" . translate("Today") . "</div></i></td></tr></table>\n</td>"; echo "<td align=right valign=top width='30%'>"; echo "<form action=POST><div class=menufont>\n"; echo "<b>" . translate("Go to") . ": </b>"; // get months echo "<select name=gomonth onchange=\"javascript:gotomonth(this);\">\n"; for ($i = 1; $i < 13; $i++) { echo "\t<option value=" . $i; if ($month == $i) { echo " selected "; } echo ">" . ucfirst($mth[$i]) . "\n"; } echo "</select> \n"; // get year from "calstartyear" and give "caladvanceyear" years more to select echo "<select name=goyear onchange=\"javascript:gotoyear(this);\">\n"; for ($i = $calstartyear; $i <= $y + $caladvanceyear; $i++) { echo "\t<option value={$i}"; if ($year == $i) { echo " selected "; } echo ">{$i}\n"; } echo "</select><br/>\n"; echo "</div></form>"; echo "</td>"; // display search echo "<td align=right valign=bottom width='40%'>"; if ($allowsearch == 1 && $searchmonthok == 1) { search(); } else { echo " "; } echo "</td></tr>"; echo "</table>"; } else { echo "<br/><div class=titlefont>" . translate("disabled") . ".</div>"; } }
function commit(&$data) { $cfg = array(); Installer::$urlMode = $this->urls; #Content options - category IDs foreach ($this->catid as $lang => $id) { $cfg['start'][$lang] = $id; } require './cfg/content.php'; $o = new Config('content'); $o->save($cfg); $cfg = array(); require './cfg/main.php'; #Get Sblam! key if (function_exists('fsockopen')) { $key = @file_get_contents('http://sblam.com/keygen.html'); $cfg['captcha'] = 1; $cfg['sbKey'] = $key ? $key : NULL; } else { $cfg['captcha'] = 0; $cfg['sbKey'] = NULL; } #Main options - page title and URL format $cfg['title'] = $this->title; $cfg['RSS'] = $this->rss; $o = new Config('main'); $o->add('cfg', $cfg); $o->save(); #Database access - db.php $this->buildConfig($data); #Rebuild polls if (file_exists('./mod/polls')) { include './mod/polls/poll.php'; RebuildPoll(null, $this->db); } #Sort categories include './lib/categories.php'; RebuildTree($this->db); RSS(null, $this->db); #Create menu cache include './lib/mcache.php'; RenderMenu($this->db); #Finish :) $this->db->commit(); }
function main() { try { global $locale; global $RSS; global $session; global $gs; global $searchTitle; global $thisURI; global $PAGE_MAX; global $curOffset; global $editable; $curOffset = trim($_GET['offset']); $curOffset = $curOffset == "" ? 1 : $curOffset; $removes = array(); $movs = new Movies(); $catID = $_GET['catID']; $searchTitle = $_POST['txtSearch']; if ($searchTitle == '') { $searchTitle = $_GET['txtSearch']; } if ($searchTitle == '') { if ($editable) { $movs->LoadWhere('nowPlaying=1'); } else { $movs->LoadWhere('nowPlaying=1 AND visible=1'); } } else { if ($editable) { $movs->Search($searchTitle); } else { $movs->SearchWhereVisiable($searchTitle); } $session->Searched('Movies', $searchTitle); } $movs->Sort('Title'); if ($catID != '') { foreach ($movs as $mov) { $cats = $mov->Categories(); if (!$cats->Contains($catID)) { $removes[] = $mov; } } foreach ($removes as $remove) { $movs->Remove($remove); } } if ($RSS) { RSS($movs); } else { $session->Viewed("Movies", 0, $gs->ActionMsg2ID("ViewedNowPlaying")); } $rssLink = AppendKVP($thisURI, "RSS=1"); ?> <a type="application/rss+xml" href="<?php echo $rssLink; ?> ">RSS</a> <br/> <?php $i = $printedCnt = 0; $extraQryKVPs = array(); if ($catID != "") { $extraQryKVPs[] = "catID={$catID}"; } if ($searchTitle != "") { $extraQryKVPs[] = "txtSearch={$searchTitle}"; } $nav = NavHTML($movs, $curOffset, $PAGE_MAX, $extraQryKVPs); ?> <table> <tr> <td align="center"> <?php echo $nav; ?> </td> </tr> <tr> <td> <?php foreach ($movs as $mov) { if (++$i < $curOffset) { continue; } if (++$printedCnt > $PAGE_MAX) { break; } $otherSiteLinks =& $mov->OtherSiteLinks(); $reviewLinks =& $mov->ReviewLinks(); $trailerLinks =& $mov->TrailerLinks(); $stars =& $mov->Stars(); $writers =& $mov->Writers(); $directors =& $mov->Directors(); $stars->Sort('Name'); $writers->Sort('Name'); $directors->Sort('Name'); $movID =& $mov->ID(); ?> <br/> <table bgcolor="#dddddd" frame="border" width="800"> <tr valign="top"> <?php if (file_exists($mov->MainPicture())) { ?> <td> <a href="movie.php?id=<?php echo $mov->ID(); ?> "> <img src="<?php echo $mov->MainPicture(); ?> " alt=""/></a> </td> <?php } ?> <td> <table cellspacing="1" width="700"> <tr> <td colspan="2" bgcolor="#cccccc"> <b><a href="movie.php?id=<?php echo $mov->ID(); ?> "> <?php echo $mov->Title(); ?> </a></b> </td> </tr> <tr> <td> <?php if ($stars->Count() > 1) { print "<b>" . GetCap('capStars') . ": </b>"; } else { print "<b>" . GetCap('capStar') . ": </b>"; } ?> </td> <td> <?php foreach ($stars as $per) { $id = $per->ID(); $name = $per->Name(); print "<a href=\"person.php?id={$id}\">{$name}</a> "; } ?> </td> </tr> <tr> <td> <?php if ($directors->Count() > 1) { print "<b>" . GetCap('capDirectors') . ": </b>"; } else { print "<b>" . GetCap('capDirector') . ": </b>"; } ?> </td> <td> <?php foreach ($directors as $per) { $id = $per->ID(); $name = $per->Name(); print "<a href=\"person.php?id={$id}\">{$name}</a> "; } ?> </td> </tr> <tr> <td> <?php if ($writers->Count() > 1) { print "<b>" . GetCap('capWriters') . ": </b>"; } else { print "<b>" . GetCap('capWriter') . ": </b>"; } ?> </td> <td> <?php foreach ($writers as $per) { $id = $per->ID(); $name = $per->Name(); print "<a href=\"person.php?id={$id}\">{$name}</a> "; } ?> </td> </tr> <tr> <td valign="top"> <b><?php echo GetCap('capPlot'); ?> : </b> </td> <td> <?php echo wordwrap($mov->PlotOutline($locale), 75, '<br />'); ?> </td> </tr> <tr> <td> <b><?php echo GetCap('capCategories'); ?> :</b> </td> <td> <?php $cats =& $mov->Categories(); $writers =& $mov->Categories(); $directors =& $mov->Categories(); foreach ($cats as $cat) { $catID0 = $cat->ID(); $name = $cat->Name($locale); print "<a href=\"movies.php?catID={$catID0}\">{$name}</a> "; } ?> </td> </tr> <tr> <td> <b><?php echo GetCap('capTrailers'); ?> : </b> </td> <td> <?php foreach ($trailerLinks as $link) { ?> <a href="<?php echo $link->URL(); ?> "><?php echo GetCap($link->Source()); ?> </a> <?php } ?> </td> </tr> <tr> <td> <b><?php echo GetCap('capReviews'); ?> : </b> </td> <td> <?php foreach ($reviewLinks as $link) { ?> <a href="<?php echo $link->URL(); ?> "><?php echo GetCap($link->Source()) . ' (' . $link->Author() . ')'; ?> </a> <?php } ?> </td> </tr> <tr> <td> <b><?php echo GetCap('capOtherSites'); ?> : </b> </td> <td> <?php foreach ($otherSiteLinks as $link) { ?> <a href="<?php echo $link->URL(); ?> "><?php echo GetCap($link->Source()); ?> </a> <?php } ?> </td> </tr> </table> </td> </tr> </table> <?php } ?> </td> </tr> <tr> <td align="center"> <?php echo $nav; ?> </td> </tr> </table> <?php } catch (Exception $ex) { ProcessException($ex); } }
#Save RSS if ($_POST) { $rss = array('name' => clean($_POST['name']), 'dsc' => clean($_POST['dsc']), 'url' => clean($_POST['url']), 'lang' => ctype_alnum($_POST['lang']) ? $_POST['lang'] : LANG, 'auto' => isset($_POST['auto']), 'cat' => (int) $_POST['cat'], 'num' => (int) $_POST['num']); try { if ($id) { $q = $db->prepare('UPDATE ' . PRE . 'rss SET auto=:auto, name=:name, dsc=:dsc, url=:url, lang=:lang, cat=:cat, num=:num WHERE ID=' . $id); } else { $q = $db->prepare('INSERT INTO ' . PRE . 'rss (auto,name,dsc,url,lang,cat,num) VALUES (:auto,:name,:dsc,:url,:lang,:cat,:num)'); } $q->execute($rss); if (!$id) { $id = $db->lastInsertId(); } #Rebuild RSS RSS($id); header('Location: ' . URL . url('rss/update', '', 'admin')); return 1; } catch (Exception $e) { $view->info($e); } } elseif ($id) { if (!($rss = $db->query('SELECT * FROM ' . PRE . 'rss WHERE ID=' . $id)->fetch(2))) { return; } } else { $rss = array('name' => '', 'dsc' => '', 'auto' => 1, 'num' => 20, 'cat' => 0, 'lang' => LANG, 'url' => URL); } #Prepare template $view->add('editRss', array('rss' => $rss, 'cats' => Slaves(5, $rss['cat']), 'langs' => listBox('lang', 1, $rss['lang'])));