function album_debugEx($file, $line) { global $album_config; if ($album_config['album_debug_mode'] == 1 || album_is_debug_enabled() == true) { $out_array = array(); $output_format = 'DEBUG :<br />'; $output_format .= !empty($file) ? 'FILE : ' . $file . '<br />' : ''; $output_format .= !empty($line) ? 'LINE : ' . $line . '<br />' : ''; $output_format .= '----------------------------------------------------<br />'; $output_format .= '%s<br />'; $output_format .= '----------------------------------------------------<br />'; $array = func_get_args(); $numargs = func_num_args(); if (gettype($array[2]) == 'array') { print '<pre>' . print_r($array[2], true) . '</pre>'; return; } $intermediat_format = $array[2]; for ($i = 3; $i <= $numargs; $i++) { $out_array[] = album_debug_render($array[$i]); } $out_text = vsprintf($intermediat_format, $out_array); @printf($output_format, $out_text); } }
function album_get_auth_data($cat_id) { global $album_data; if ($cat_id != ALBUM_ROOT_CATEGORY && (!isset($album_data) || !is_array($album_data) || sizeof($album_data) == 0)) { //$auth_data = //album_user_access($cat_id, 0, 1, 1, 1, 1, 1, 1); $auth_data = album_permissions(0, $cat_id, 0, ALBUM_AUTH_ALL); return $auth_data; } if (album_is_debug_enabled() == true) { if (!array_key_exists($cat_id, $album_data['auth'])) { return false; } } else { if (@(!array_key_exists($cat_id, $album_data['auth']))) { return false; } } return $album_data['auth'][$cat_id]; }
function album_no_newest_pictures($check_date, $cats, $exclude_cat_id = 0) { global $db, $config, $user, $lang, $album_config; $user_last_visit = $user->data['user_lastvisit']; $pictotalrows = array(); if (is_null($cats)) { return $pictotalrows; } // -------------------------------------------------------------------- // NOTE : this function is weighted, meaning that days has higher // priority then months, and month higher priority then hours // // if $check_data = 12HMD, then we uses 12 days to calcuate // if $check_data = 12HM, then we uses 12 month calcuate...and so on // -------------------------------------------------------------------- $check_date = strtoupper($check_date); // are we checking hours ? if (strstr($check_date, 'H') != false) { $multiplier = 60 * 60; } // are we checking months ? if (strstr($check_date, 'M') != false) { $multiplier = 30 * 24 * 60 * 60; // in my world a month is always 30 days ;) } // are we checking weeks ? if (strstr($check_date, 'W') != false) { $multiplier = 7 * 24 * 60 * 60; // in my world a month is always 30 days ;) } // are we checking days (default) ? - yes if multiplier is zero if (strstr($check_date, 'D') != false || $multiplier == 0) { $multiplier = 24 * 60 * 60; } // remove all the alpha characters from the string, since they aren't needed anymore $check_date = preg_replace('/[A-Z]+/', '', trim($check_date)); // doa final test to see if it's a valid checkm further more // if intval should return 0 then we will not find any images // that are new, except those that only are a few second old // but we don't want to do a trip to the database just because of that // the minimum is 1 hour. if (intval($check_date) == 0) { return $pictotalrows; } // calculate the difference from today and the desired check date (beta code !) $curtime = time() - $multiplier * intval($check_date); //album_debug('date = %s',create_date($config['default_dateformat'], $curtime, $config['board_timezone'])); if ($album_config['show_index_last_pic_lv'] == 1) { $sql_time = ' AND p.pic_time >= ' . $user_last_visit; } else { $sql_time = ' AND p.pic_time >= ' . $curtime; } $sql_exclude = $exclude_cat_id != 0 ? ' AND NOT IN (' . $exclude_cat_id . ')' : ''; $sql_include = is_array($cats) ? implode(',', $cats) : $cats; $sql = 'SELECT c.cat_id, p.pic_id, COUNT(p.pic_id) AS pic_total FROM ' . ALBUM_TABLE . ' AS p, ' . ALBUM_CAT_TABLE . ' AS c WHERE c.cat_id IN (' . $sql_include . ')' . $sql_exclude . ' AND p.pic_cat_id = c.cat_id ' . $sql_time . ' GROUP BY c.cat_id'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $pictotalrows[$row['cat_id']] = $row['pic_total']; } $db->sql_freeresult($result); if (album_is_debug_enabled() == true) { album_debug('album_no_newest_pictures sql = %s', $sql); album_debug('$pictotalrows = %s', $pictotalrows); } return $pictotalrows; }
function album_display_index($user_id, $cur_cat_id = ALBUM_ROOT_CATEGORY, $show_header = false, $show_public_footer = false, $force_display = false) { global $lang, $config, $template, $images, $album_data, $album_config, $user; $keys = array(); // for testing ONLY if (album_is_debug_enabled() == true) { if (strcmp($cur_cat_id, 'Root') == 0) { die('WRONG ROOT VALUE'); } } $is_personal_gallery = $user_id != ALBUM_PUBLIC_GALLERY ? true : false; // if we are showing a personal gallery AND we are at the root of personal gallery // then ignore the root folder of the personal gallery, since it's 'hidden' if ($is_personal_gallery && $cur_cat_id == ALBUM_ROOT_CATEGORY) { $cur_cat_id = album_get_personal_root_id($user_id); } $template->set_filenames(array('album' => 'album_box.tpl')); $keys = album_get_auth_keys($cur_cat_id, ALBUM_AUTH_VIEW); $display = album_build_index($user_id, $keys, $cur_cat_id, ALBUM_ROOT_CATEGORY, ALBUM_ROOT_CATEGORY); if ($force_display && !$is_personal_gallery && sizeof($album_data) == 0) { $template->assign_block_vars('catmain', array()); $template->assign_block_vars('catmain.catrow', array('CAT_TITLE' => $lang['No_Public_Galleries'], 'CAT_IMG' => $images['forum_nor_locked_read'])); $display = true; } // Added so that, even if there are no public galleries, the member or user galleries can be reached if ($force_display && !$is_personal_gallery && !$display) { $display = true; } // lets do some debugging.. if (album_is_debug_enabled() == true) { album_debug('$user_id = %d<br />$cur_cat_id = %d<br />$display = %d<br />album data = %s<br />authentication keys = %s', $user_id, $cur_cat_id, intval($display), $album_data, $keys); } if ($display || album_is_debug_enabled() == true) { if ($show_header) { // create header and send it to template $template->assign_block_vars('catheader', array('L_CATEGORY' => $lang['Category'], 'L_PUBLIC_CATS' => !$is_personal_gallery ? $lang['Public_Categories'] : sprintf($lang['Personal_Gallery_Of_User'], album_get_user_name($user_id)), 'U_YOUR_PERSONAL_GALLERY' => append_sid(album_append_uid('album.' . PHP_EXT . '?user_id=' . $user->data['user_id'])), 'L_YOUR_PERSONAL_GALLERY' => $lang['Your_Personal_Gallery'], 'U_USERS_PERSONAL_GALLERIES' => append_sid(album_append_uid('album_personal_index.' . PHP_EXT)), 'L_USERS_PERSONAL_GALLERIES' => $lang['Users_Personal_Galleries'])); $cols_span = album_generate_index_columns($username); // but we need to specificly specify if we want to show the public gallery header if ($show_public_footer == true) { $template->assign_block_vars('catfooter.cat_public_footer', array('U_YOUR_PERSONAL_GALLERY' => append_sid(album_append_uid('album.' . PHP_EXT . '?user_id=' . $user->data['user_id'])), 'L_YOUR_PERSONAL_GALLERY' => $lang['Your_Personal_Gallery'], 'U_USERS_PERSONAL_GALLERIES' => append_sid(album_append_uid('album_personal_index.' . PHP_EXT)), 'L_USERS_PERSONAL_GALLERIES' => $lang['Users_Personal_Galleries'], 'FOOTER_COL_SPAN' => $cols_span)); if ($album_config['show_otf_link'] == 1) { $template->assign_block_vars('catfooter.cat_public_footer.show_otf_link', array()); } if ($album_config['show_all_pics_link'] == 1) { $template->assign_block_vars('catfooter.cat_public_footer.show_all_pics_link', array()); } if ($album_config['show_personal_galleries_link'] == 1) { $template->assign_block_vars('catfooter.cat_public_footer.show_personal_galleries_link', array()); } } } $template->assign_var_from_handle('ALBUM_BOARD_INDEX', 'album'); } return $display; }
if (sizeof($upload_errors) > 0) { if ($pic_count == sizeof($upload_errors)) { $message = $lang['Album_upload_not_successful']; } else { $message = $lang['Album_upload_partially_successful']; } for ($index = 0; $index < sizeof($upload_errors); $index++) { $message .= $upload_errors[$index]; } } elseif ($thiscat['cat_approval'] == 0) { $message = $lang['Album_upload_successful']; } else { $message = $lang['Album_upload_need_approval']; } if ($thiscat['cat_approval'] == 0 && sizeof($upload_errors) == 0) { if (album_is_debug_enabled() == false) { $redirect_url = append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id)); meta_refresh(3, $redirect_url); } } if ($album_user_id == ALBUM_PUBLIC_GALLERY) { $message .= '<br /><br />' . sprintf($lang['Click_return_category'], '<a href="' . append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id)) . '">', '</a>'); } else { $message .= '<br /><br />' . sprintf($lang['Click_return_personal_gallery'], '<a href="' . append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id)) . '">', '</a>'); } $message .= '<br /><br />' . sprintf($lang['Click_return_album_index'], '<a href="' . append_sid('album.' . PHP_EXT) . '">', '</a>'); synchronize_cat_pics_counter($cat_id); if ($album_config['switch_nuffload'] == 1) { message_die(GENERAL_MESSAGE, multi_loop($message, true)); } else { message_die(GENERAL_MESSAGE, $message);