Author Topic: Addiotional Mod Events/Calendar  (Read 3666 times)

0 Members and 1 Guest are viewing this topic.

Offline Albert

  • Newbie
  • *
  • Posts: 45
    • View Profile
Addiotional Mod Events/Calendar
« on: September 12, 2005, 08:08:05 PM »
Hi, I have a friend that's trying to help me create a mod for displaying a list of events on the site... but he keeps the error message   "You are not logged in
or do not have permissions to enter this site!"   will be displayed when trying to submit events into the database.

here is what he has... I'm not a programer...  :oops:

Quote
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: top.php                                              *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) fr weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template = 'today2';

define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');

$cache_id = create_cache_id(
  'today2',
  array(
    $user_info[$user_table_fields['user_id']],
    $cat_id,
    $config['template_dir'],
    $config['language_dir']
  )
);

if (!$cache_page_top || !$content = get_cache_file($cache_id)) {
if ($cache_page_top) {
  // Always append session id if cache is enabled
  $old_session_mode = $site_sess->mode;
  $site_sess->mode = 'get';
}

//$url_member=$site_sess->url(ROOT_PATH."today_events2.php");

ob_start();

$cat_match_sql = ($cat_id && check_permission("auth_viewcat", $cat_id)) ? "AND i.cat_id = '$cat_id' " : "";
$register_array = array();

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

// Rating

$site_template->register_vars(array(
    "bbcode" => $bbcode,
    "comment_id" => $comment_id,
    "image_name" => htmlspecialchars($comment_row['image_name']),
    "user_name" => htmlspecialchars($user_name),
    "comment_headline" => htmlspecialchars($comment_headline),
    "comment_text" => htmlspecialchars($comment_text),
    "lang_edit_comment" => $lang['add_event'],
    "lang_image_name" => $lang['image_name'],
    "lang_name" => $lang['name'],
    "lang_headline" => $lang['day'],
    "lang_comment" => $lang['event'],
    "lang_submit" => $lang['submit'],
    "lang_reset" => $lang['reset'],
    "lang_yes" => $lang['yes'],
    "lang_no" => $lang['no']
  ));
  $content = $site_template->parse_template("member_editcomment");

// $site_template->register_vars($register_array);

//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
$error = 0;
//if ($action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {
  $id = intval($HTTP_POST_VARS[URL_ID]);
//   $sql = "SELECT cat_id, image_allow_comments
//           FROM ".IMAGES_TABLE."
//           WHERE image_id = $id";
//   $row = $site_db->query_firstrow($sql);
//
//   if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
//     $msg = $lang['comments_deactivated'];
//   }
//   else {
    $user_name = un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
    $comment_headline = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
    $comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));

    // Flood Check
//     $sql = "SELECT comment_ip, comment_date
//             FROM ".COMMENTS_TABLE."
//             WHERE image_id = $id
//             ORDER BY comment_date DESC
//             LIMIT 1";
//     $spam_row = $site_db->query_firstrow($sql);
//     $spamtime = $spam_row['comment_date'] + 180;
//
//     if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
//       $msg .= (($msg != "") ? "<br />" : "").$lang['spamming'];
//       $error = 1;
//     }

//     $user_name_field = get_user_table_field("", "user_name");
//     if (!empty($user_name_field)) {
//       if ($site_db->not_empty("SELECT $user_name_field FROM ".USERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("", "user_id")." <> '".$user_info['user_id']."'")) {
//         $msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
//         $error = 1;
//       }
//     }
//     if ($user_name == "")  {
//       $msg .= (($msg != "") ? "<br />" : "").$lang['name_required'];
//       $error = 1;
//     }
//     if ($comment_headline == "")  {
//       $msg .= (($msg != "") ? "<br />" : "").$lang['headline_required'];
//       $error = 1;
//     }
//     if ($comment_text == "")  {
//       $msg .= (($msg != "") ? "<br />" : "").$lang['comment_required'];
//       $error = 1;
//     }
//
//     if (!$error)  {
//    echo "Hai";
      $sql = "INSERT INTO 4images_addevent (day,event) values('$comment_headline','$comment_text')";
      $site_db->query($sql);
      $commentid = $site_db->get_insert_id();
     // echo "$commentid";
      update_comment_count($id, $user_info['user_id']);
//    }
// }
  unset($row);
  unset($spam_row);
}




//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($cat_id && isset($cat_cache[$cat_id])) {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $lang['top_images']."</span>";

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
// $site_template->register_vars(array(
//   "msg" => $msg,
//   "clickstream" => $clickstream,
//   "lang_top_image_hits" => $lang['top_image_hits'],
//   "lang_top_image_downloads" => $lang['top_image_downloads'],
//   "lang_top_image_rating" => $lang['top_image_rating'],
//   "lang_top_image_votes" => $lang['top_image_votes']
// ));
// $site_template->print_template($site_template->parse_template($main_template));

$site_template->register_vars(array(
  "content" => $content,
  "msg" => $msg,
  "clickstream" => $clickstream,
  "lang_control_panel" => $lang['control_panel']
));
$site_template->print_template($site_template->parse_template($main_template));

$content = ob_get_contents();
ob_end_clean();

if ($cache_page_top) {
  // Reset session mode
  $site_sess->mode = $old_session_mode;

  save_cache_file($cache_id, $content);
}

//} // end if get_cache_file()

echo $content;

include(ROOT_PATH.'includes/page_footer.php');
?>

Can someone help please : )

Offline beseech

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: Addiotional Mod Events/Calendar
« Reply #1 on: October 12, 2005, 07:45:45 PM »
thats a nice ideia ;)