| La Unión | Municipios | Salud | Turismo | GOBSA |
|
"AA_SL_Session"));
$sess->register(r_packed_state_vars);
$sess->register(slices);
$r_state_vars = unserialize($r_packed_state_vars);
# there was problems with storing too much ids in session veriable,
# so I commented it out. It is not necessary to have it in session. The only
# reason to have it there is the display speed, but because of impementing
# pagecache.php3, it is not so big problem now
//$sess->register(item_ids);
list($usec, $sec) = explode(" ",microtime());
$slice_starttime = ((float)$usec + (float)$sec);
if ($encap) add_vars(""); # adds values from QUERY_STRING_UNESCAPED
# and REDIRECT_STRING_UNESCAPED
// p_arr_m( $r_state_vars );
if( ($key != $lock) OR $scrl ) # command is for other slice on page
RestoreVariables(); # or scroller
# url posted command to display specified text instead of slice content -------
if($slicetext) {
echo $slicetext;
ExitPage();
}
# url posted command to display another file ----------------------------------
if( $inc ) { # this section must be after add_vars()
// StoreVariables(array("inc")); # store in session
if( !eregi("^([0-9a-z_])+(\.[0-9a-z]*)?$", $inc) ) {
echo _m("Bad inc parameter - included file must be in the same directory as this .shtml file and must contain only alphanumeric characters"). " $inc";
ExitPage();
} else {
$fp = @fopen( shtml_base().$inc, "r"); # if encapsulated
if( !$fp )
echo _m("No such file") ." $inc";
else
FPassThru($fp);
ExitPage();
}
}
// Take any slice to work with
if (!$slice_id && is_array($slices)) {
reset ($slices);
$slice_id = current($slices);
}
$p_slice_id= q_pack_id($slice_id);
require_once $GLOBALS["AA_INC_PATH"]."javascript.php3";
$db = new DB_AA; // open BD
$db2 = new DB_AA; // open BD (for subqueries in order to fullfill fulltext in feeded items)
$db3 = new DB_AA; // open BD (for another subqueries)
# get fields info
list($fields) = GetSliceFields($slice_id);
# get slice info
$slice_info = GetSliceInfo($slice_id);
if ($slice_info AND ($slice_info[deleted]<1)) {
// include $GLOBALS["AA_INC_PATH"] . $slice_info[lang_file]; // language constants (used in searchform...)
}
else {
echo _m("Invalid slice number or slice was deleted") . " (ID: $slice_id)";
ExitPage();
}
// Use right language (from slice settings) - languages are used for scroller (Next, ...)
$lang_file = substr ($slice_info['lang_file'], 0, 2);
if (!$LANGUAGE_NAMES [$lang_file])
$lang_file = "en";
bind_mgettext_domain ($GLOBALS["AA_INC_PATH"]."lang/".$lang_file."_output_lang.php3");
if( !$slice_info['even_odd_differ'] )
$slice_info['even_row_format'] = "";
# it is possible to redefine the design of fulltext or compact view by the view
# see fview and iview url parameters for this file (slice.php3)
if( $fview || $iview ) {
if( $fview ) { # use formating from view for fulltext
$fview_info = GetViewInfo($fview);
if ($fview_info AND ($fview_info['deleted']<1)) {
$slice_info['fulltext_format'] = $fview_info['odd'];
$slice_info['fulltext_format_top'] = $fview_info['before'];
$slice_info['fulltext_format_bottom'] = $fview_info['after'];
$slice_info['fulltext_remove'] = $fview_info['remove_string'];
// print_r( $slice_info );
}
}
if( $iview ) { # use formating from view for index
$iview_info = GetViewInfo($iview);
if ($iview_info AND ($iview_info['deleted']<1)) {
$slice_info['group_by'] = $iview_info['group_by1'];
$slice_info['category_format'] = $iview_info['group_title'];
$slice_info['category_bottom'] = $iview_info['group_bottom'];
$slice_info['compact_top'] = $iview_info['before'];
$slice_info['compact_bottom'] = $iview_info['after'];
$slice_info['compact_remove'] = $iview_info['remove_string'];
$slice_info['even_row_format'] = $iview_info['even'];
$slice_info['odd_row_format'] = $iview_info['odd'];
$slice_info['even_odd_differ'] = $iview_info['even_odd_differ'];
}
}
}
define("DEFAULT_CODEPAGE","windows-1250");
if (!$encap)
Page_HTML_Begin ($slice_info[name]);
if( $bigsrch ) { # big search form ------------------------------------------
echo '';
ExitPage();
}
GetAliasesFromUrl();
$urlaliases = $aliases;
// if banner parameter supplied => set format
ParseBannerParam($slice_info, $banner);
# get alias list from database and possibly from url
# if working with multi-slice, get aliases for all slices
if (!is_array ($slices)) {
$aliases = GetAliasesFromFields($fields);
if (is_array ($urlaliases))
array_add ($urlaliases, $aliases);
}
else {
reset($slices);
while (list(,$slice) = each($slices)) {
list($fields) = GetSliceFields ($slice);
// hack for searching in multiple slices. This is not so nice part
// of code - we mix there $aliases[
$item_ids ";
if( !$scrl )
$scr->current = $scr_go;
}
elseif($srch) { # posted by bigsrch form -------------------
$r_state_vars = StoreVariables(array("listlen","no_scr","scr_go","big","search", "s_col")); # store in session
if( !$big )
$search[slice] = $slice_id;
$item_ids = SearchWhere($search, $s_col);
if( !$scrl )
$scr->current = $scr_go;
}
else if ($debug) echo "ERROR: This branch should never be entered.";
}
else {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Parse parameters posted by query form and from $slice_info
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$r_state_vars = StoreVariables(array("listlen","no_scr","scr_go","order","cat_id", "cat_name",
"exact","restrict","res_val","highlight","conds","group_by", "sort","als","defaultCondsOperator")); # store in session
// ***** CONDS *****
if( $cat_id ) { // optional parameter cat_id - deprecated - slow ------
$cat_group = GetCategoryGroup($slice_id);
$SQL = "SELECT value FROM constant
WHERE group_id = '$cat_group'
AND id = '". q_pack_id($cat_id) ."'";
$db->query($SQL);
if( $db->next_record() ) {
$conds[] = array (GetCategoryFieldId( $fields )=>1,
'value' => $db->f(value),
'operator' => ($exact ? '=' : 'LIKE'));
}
}
elseif ( $cat_name ) // optional parameter cat_name -------
$conds[] = array (GetCategoryFieldId( $fields )=>1,
'value' => $cat_name,
'operator' => ($exact ? '=' : 'LIKE'));
if ( $restrict )
$conds[] = array( $restrict=>1,
'value' => ((($res_val[0] == '"' OR $res_val[0] == "'") AND $exact != 2 ) ? $res_val : "'$res_val'"),
'operator' => ($exact ? '=' : 'LIKE'));
if( $highlight != "" )
$conds[] = array ('highlight.......' => 1);
if(is_array($conds)) {
if (! isset ($defaultCondsOperator))
$defaultCondsOperator = 'LIKE';
ParseEasyConds ($conds, $defaultCondsOperator);
reset($conds);
while( list( $k ) = each( $conds ))
SubstituteAliases( $als, $conds[$k]['value'] );
}
// ***** SORT *****
# order the fields in compact view
if( $order ) {
$order = GetSortArray ($order);
reset ($order);
list ($order, $orderdirection) = each ($order);
}
if ($debug)
echo "Group by: $group_by. Slice_info[category_sort] $slice_info[category_sort] slice_info[group_by] $slice_info[group_by]";
if( $group_by ) {
$foo = GetSortArray( $group_by );
$sort_tmp[] = $foo;
$slice_info["group_by"] = key($foo);
}
else if( $slice_info['category_sort'] ) {
$group_field = GetCategoryFieldId( $fields );
$grp_odir = (($order==$group_field) AND ($orderdirection!='d')) ? 'a':'d';
$sort_tmp[] = array ( $group_field => $grp_odir );
}
else if ($slice_info['group_by']) {
switch( (string)$slice_info['gb_direction'] ) { # gb_direction is number
case '1': $gbd = '1'; break; # 1 (1)- ascending by priority
case '8': $gbd = 'd'; break; # d (8) - descending
case '9': $gbd = '9'; break; # 9 (9)- descending by priority (for fields using constants)
default: $gbd = 'a'; # 2 (2) - ascending;
}
$sort_tmp[] = array ( $slice_info['group_by'] => $gbd);
}
if(isset($sort)) {
if( !is_array($sort) )
$sort_tmp[] = GetSortArray( $sort );
else {
ksort( $sort, SORT_NUMERIC); # it is not sorted and the order is important
reset($sort);
while( list($k, $srt) = each( $sort )) {
if ($srt) {
if( is_array($srt) )
$sort_tmp[] = array( key($srt) => (strtolower(current($srt)) == "d" ? 'd' : 'a'));
else
$sort_tmp[] = GetSortArray( $srt );
}
}
}
}
if( $order )
$sort_tmp[] = array ( $order => (( strstr('aAdD19',$orderdirection) ? $orderdirection : 'a')));
# time order the fields in compact view
$sort_tmp[] = array ( 'publish_date....' => (($timeorder == "rev") ? 'a' : 'd') );
if( isset($sort_tmp) )
$sort = $sort_tmp;
else
$sort[] = array ( 'publish_date....' => 'd' );
$zids=QueryZIDs($fields, $slice_id, $conds, $sort, $slice_info[group_by],
"ACTIVE", $slices, $neverAllItems, 0, $defaultCondsOperator, true );
// Commented out because queryids doesn't return error strings
// if( isset($item_ids) AND !is_array($item_ids))
// echo "$item_ids ";
if( !$scrl )
$scr->current = $scr_go;
//$slice_info[category_sort] = false; # do not sort by categories
}
if( !$srch AND !$encap AND !$easy_query ) {
$cur_cats=GetCategories($db,$p_slice_id); // get list of categories
pCatSelector($sess->name,$sess->id,$sess->MyUrl($slice_id, $encap, true),$cur_cats,$scr->filters[category_id][value], $slice_id, $encap);
}
//echo "aa - scr->current=$scr->current"; if( $zids->count() > 0 ) { $scr->countPages( $zids->count() ); $itemview = new itemview($slice_info, $fields, $aliases, $zids, $scr->metapage * ($scr->current - 1), ($group_n ? -$group_n : $scr->metapage), # negative number used for displaying n-th group $sess->MyUrl($slice_id, $encap) ); $itemview->print_view(); if( ($scr->pageCount() > 1) AND !$no_scr AND !$group_n) $scr->pnavbar(); } else { echo $slice_info['noitem_msg'] ? // is keyword for removing 'no item message' str_replace( '', '', $slice_info['noitem_msg']) : (" "._m("No item found") ." ");
}
if ($searchlog) PutSearchLog ();
if( $debug ) {
$timeend = getmicrotime();
$time = $timeend - $timestart;
echo "Page generation time: $time"; } ExitPage(); ?> |
-86400 # generalized version of cmd[]-c # - fields and operators specifed # - unlimited number of conditions # - all default conditions from view definition are # completely redefined by the specified ones #optionaly set[] # setings to modify view behavior (can be combined with cmd) # set[23]=listlen-20 # - sets maximal number of viewed items in view 23 to 20 # - there can be more settings (future) - comma separated #optionaly als[] # user alias - see slice.php3 for more details # for more info see AA FAQ: http://apc-aa.sourceforge.net/faq/index.shtml#219 # handle with PHP magic quotes - quote the variables if quoting is set off function Myaddslashes($val, $n=1) { if (!is_array($val)) { return addslashes($val); } for (reset($val); list($k, $v) = each($val); ) $ret[$k] = Myaddslashes($v, $n+1); return $ret; } if (!get_magic_quotes_gpc()) { // Overrides GPC variables if( isset($HTTP_GET_VARS) AND is_array($HTTP_GET_VARS)) for (reset($HTTP_GET_VARS); list($k, $v) = each($HTTP_GET_VARS); ) $$k = Myaddslashes($v); if( isset($HTTP_POST_VARS) AND is_array($HTTP_POST_VARS)) for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); ) $$k = Myaddslashes($v); if( isset($HTTP_COOKIE_VARS) AND is_array($HTTP_COOKIE_VARS)) for (reset($HTTP_COOKIE_VARS); list($k, $v) = each($HTTP_COOKIE_VARS); ) $$k = Myaddslashes($v); } require_once "./include/config.php3"; require_once $GLOBALS["AA_INC_PATH"]."easy_scroller.php3"; require_once $GLOBALS["AA_INC_PATH"]."util.php3"; require_once $GLOBALS["AA_INC_PATH"]."item.php3"; require_once $GLOBALS["AA_INC_PATH"]."view.php3"; require_once $GLOBALS["AA_INC_PATH"]."discussion.php3"; require_once $GLOBALS["AA_INC_PATH"]."pagecache.php3"; require_once $GLOBALS["AA_INC_PATH"]."searchlib.php3"; require_once $GLOBALS["AA_INC_PATH"]."locsessi.php3"; # DB_AA object definition add_vars(); if (isset($slice_id)) $p_slice_id= q_pack_id($slice_id); $db = new DB_AA; // open BD $db2 = new DB_AA; // open BD $db3 = new DB_AA; // open BD if ($time_limit) set_time_limit($time_limit); if ($debug) huhl("Starting view"); echo GetView(ParseViewParameters()); if ($debug) huhl("Completed view"); exit; ?> No podria connectar : Access denied for user 'huayna'@'localhost' (using password: YES) -86400 # generalized version of cmd[]-c # - fields and operators specifed # - unlimited number of conditions # - all default conditions from view definition are # completely redefined by the specified ones #optionaly set[] # setings to modify view behavior (can be combined with cmd) # set[23]=listlen-20 # - sets maximal number of viewed items in view 23 to 20 # - there can be more settings (future) - comma separated #optionaly als[] # user alias - see slice.php3 for more details # for more info see AA FAQ: http://apc-aa.sourceforge.net/faq/index.shtml#219 # handle with PHP magic quotes - quote the variables if quoting is set off function Myaddslashes($val, $n=1) { if (!is_array($val)) { return addslashes($val); } for (reset($val); list($k, $v) = each($val); ) $ret[$k] = Myaddslashes($v, $n+1); return $ret; } if (!get_magic_quotes_gpc()) { // Overrides GPC variables if( isset($HTTP_GET_VARS) AND is_array($HTTP_GET_VARS)) for (reset($HTTP_GET_VARS); list($k, $v) = each($HTTP_GET_VARS); ) $$k = Myaddslashes($v); if( isset($HTTP_POST_VARS) AND is_array($HTTP_POST_VARS)) for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); ) $$k = Myaddslashes($v); if( isset($HTTP_COOKIE_VARS) AND is_array($HTTP_COOKIE_VARS)) for (reset($HTTP_COOKIE_VARS); list($k, $v) = each($HTTP_COOKIE_VARS); ) $$k = Myaddslashes($v); } require_once "./include/config.php3"; require_once $GLOBALS["AA_INC_PATH"]."easy_scroller.php3"; require_once $GLOBALS["AA_INC_PATH"]."util.php3"; require_once $GLOBALS["AA_INC_PATH"]."item.php3"; require_once $GLOBALS["AA_INC_PATH"]."view.php3"; require_once $GLOBALS["AA_INC_PATH"]."discussion.php3"; require_once $GLOBALS["AA_INC_PATH"]."pagecache.php3"; require_once $GLOBALS["AA_INC_PATH"]."searchlib.php3"; require_once $GLOBALS["AA_INC_PATH"]."locsessi.php3"; # DB_AA object definition add_vars(); if (isset($slice_id)) $p_slice_id= q_pack_id($slice_id); $db = new DB_AA; // open BD $db2 = new DB_AA; // open BD $db3 = new DB_AA; // open BD if ($time_limit) set_time_limit($time_limit); if ($debug) huhl("Starting view"); echo GetView(ParseViewParameters()); if ($debug) huhl("Completed view"); exit; ?> |