Welcome to Geeklog, Anonymous Thursday, April 25 2024 @ 03:27 pm EDT

Geeklog Forums

Qestion about forum pluggin & images


Status: offline

jordydme

Forum User
Full Member
Registered: 11/03/05
Posts: 135
With the Geeeklog forum pluggin, does it have the ability to let users upload images . If so, is there also an automated resize function with that? I am currently running the phpbb bridge and am thinking of switching to the native GL forum pluggin but I love the upload pic mod that I have been using with phpbb.

Thanks for taking that time,
Jordy
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Hi Jordy,

I don't presently have that option but it's on my list to add. One issue we have with allowing images to be uploaded by users is security. Hackers love to include executeable code in what would appear to be an image and it's a lot of work to add all the necessary checks and filtering to prevent this.

Since one of the primary objectives and differentiators for Geeklog is security. If we could trust all our site users to not post spam and hostile content then it would be a lot less work to add more features.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Jordy

Anonymous
Thanks Blaine, I appreciate the explanation.

Coincidently, I am working on testing an addon that I jsut realized you wrote. I haave been working all day with it and have come pretty far with it but am at a standstill with it right now.

I have a feeling that my problem may be in lib-custom cause everything else seemed pretty clear to me. Here is my code for lib-custom:

Text Formatted Code
<?php

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog 1.3                                                               |
// +---------------------------------------------------------------------------+
// | lib-custom.php                                                            |
// | Your very own custom Geeklog library.                                     |
// |                                                                           |
// | This is the file where you should put all of your custom code.  When      |
// | possible you should not alter lib-common.php but, instead, put code here. |
// | This will make upgrading to future versions of Geeklog easier for you     |
// | because you will always be gauranteed that the Geeklog developers will    |
// | NOT add code to this file. NOTE: we have already gone through the trouble |
// | of making sure that we always include this file when lib-common.php is    |
// | included some place so you will have access to lib-common.php.  It        |
// | follows then that you should not include lib-common.php in this file      |
// |                                                                           |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2005 by the following authors:                         |
// |                                                                           |
// | Authors: Tony Bibbs       - tony AT tonybibbs DOT com                     |
// |          Blaine Lang      - blaine AT portalparts DOT com                 |
// |          Dirk Haun        - dirk AT haun-online DOT de                    |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
//
// $Id: lib-custom.php,v 1.11.2.1 2005/10/03 09:24:36 dhaun Exp $

// You can use this global variable to print useful messages to the errorlog
// using COM_errorLog().  To see an example of how to do this, look in
// lib-common.php and see how $_COM_VERBOSE was used throughout the code
$_CST_VERBOSE = false;

/**
* Sample PHP Block function
*
* this is a sample function used by a PHP block.  This will show the rights that
* a user has in the "What you have access to" block.
*
*/
function phpblock_showrights()
{
    global $_RIGHTS, $_CST_VERBOSE;

    if ($_CST_VERBOSE) {
        COM_errorLog('**** Inside phpblock_showrights in lib-custom.php ****', 1);
    }

    $retval .= ' ';

    for ($i = 0; $i < count($_RIGHTS); $i++) {
        $retval .=  '<li>' . $_RIGHTS[$i] . '</li>' . LB;
    }

    if ($_CST_VERBOSE) {
        COM_errorLog('**** Leaving phpblock_showrights in lib-custom.php ****', 1);
    }

    return $retval;
}


/***
*
* Get Bent()
*
* Php function to tell you how if your site is grossly insecure
*
**/
function phpblock_getBent()
{
    global $_CONF, $_TABLES;

    $secure = true;

    $retval = '';

    $secure_msg = 'Could not find any gross insecurities in your site.  Do not take this ';
    $secure_msg .= 'as meaning your site is 100% secure, as no site ever is.  I can only ';
    $secure_msg .= 'check things that should be blatantly obvious.';

    $insecure_msg = '';

    // we don't have the path to the admin directory, so try to figure it out
    // from $_CONF['site_admin_url']
    $adminurl = $_CONF['site_admin_url'];
    if (strrpos ($adminurl, '/') == strlen ($adminurl)) {
        $adminurl = substr ($adminurl, 0, -1);
    }
    $pos = strrpos ($adminurl, '/');
    if ($pos === false) {
        // only guessing ...
        $installdir = $_CONF['path_html'] . 'admin/install';
    } else {
        $installdir = $_CONF['path_html'] . substr ($adminurl, $pos + 1)
                    . '/install';
    }

    if (is_dir ($installdir)) {
        $insecure_msg .= '<p>You should really remove the install directory <b>' . $installdir .'</b> once you have your site up and running without any errors.';
        $insecure_msg .= ' Keeping it around would allow malicious users the ability to destroy your current install, take over your site, or retrieve sensitive information.';

        $secure = false;
    }

    // check to see if any account still has 'password' as its password.
    $count = DB_query("select count(*) as count from {$_TABLES['users']} where passwd='" . md5('password') . "'");
    $A = DB_fetchArray($count);
    if ( $A['count'] > 0 ) {
        $secure = false;
        $insecure_msg .= '<p>You still have not changed the default password from "password" on ' . $A['count'] . ' account(s). ';
        $insecure_msg .= 'This will allow people to do serious harm to your site!';
    }

    if ($secure) {
        $retval = $secure_msg;
    } else {
        $retval = $insecure_msg;
    }
    $retval = wordwrap($retval,20,' ',1);

    return $retval;
}


/*  Sample Custom Member Functions to create and update Custom Membership registration and profile

    Note1: Enable CustomRegistration Feature in config.php
    $_CONF['custom_registration'] = true;  // Set to true if you have custom code

    Note2: This example requries a template file called memberdetail.thtml to be
    located under the theme_dir/custom directory.
    Sample is provided under /system with the distribution.

    Functions have been provided that are called from the Core Geeklog user and admin functions
    - This works with User Moderation as well
    - Admin will see the new registration info when checking a members profile only
    - All other users will see the standard User profile with the optional extended custom information
    - Customization requires changes to a few of the core template files to add {customfields} variable
    - See notes below in the custom function about the template changes
*/

/* Create any new records in additional tables you may have added  */
/* Update any fields in the core GL tables for this user as needed */
/* Called when user is first created */
function custom_usercreate($uid) {
    global $_TABLES;

    $grad_year = COM_applyFilter($_POST['cust_gradyear'],true);
    $fullname  = COM_applyFilter($_POST['cust_fullname']);

    // Ensure all data is prepared correctly before inserts, quotes may need to be escaped with addslashes()
    DB_query("INSERT INTO {$_TABLES['localuserinfo']} (uid,grad_year) VALUES ('$uid', '$grad_year')");
    DB_query("UPDATE {$_TABLES['users']} SET fullname = '$fullname' WHERE uid='$uid'");
    return true;

}

// Delete any records from custom tables you may have used
function custom_userdelete($uid) {
    global $_TABLES;

    DB_query("DELETE FROM {$_TABLES['localuserinfo']} WHERE uid='$uid'");
    return true;

}

/* Called from users.php - when user is displaying a member profile  */
/* This function can now return any extra fields that need to be shown */
/* Output is then replaced in {customfields) -- This variable needs to be added to your templates */
/* Template: path_layout/users/profile/profile.thtml */

function custom_userdisplay($uid) {
    global $_CONF,$_TABLES;
    $grad_year = DB_getItem($_TABLES['localuserinfo'], "grad_year", "uid='$uid'");
    $fullname = DB_getItem($_TABLES['users'], "fullname", "uid='$uid'");
    $retval .= '<tr>
                    <td align="right"><b>Full Name:</b></td>
                    <td>' . $fullname .'</td>
                 </tr>';
    $retval .= '<tr>
                    <td align="right"><b>Graduation Year:</b></td>
                    <td>' . $grad_year .'</td>
                 </tr>';
    return $retval;

}



/* Function called when editing user profile. */
/* Called from usersettings.php - when user is eding their own profile  */
/* and from admin/user.php when admin is editing a member profile  */
/* This function can now return any extra fields that need to be shown for editing */
/* Output is then replaced in {customfields} -- This variable needs to be added to your templates */
/* User: path_layout/preferences/profile.thtml and Admin: path_layout/admin/user/edituser.thtml */

/* This example shows adding the Cookie Timeout setting and extra text field */
/* As noted: You need to add the {customfields} template variable. */
/* For the edituser.thtml - maybe it would be added about the {group_edit} variable. */

function custom_useredit($uid) {
    global $_TABLES,$_CONF;

    $grad_year = DB_getItem($_TABLES['localuserinfo'], "grad_year", "uid='$uid'");
    $fullname = DB_getItem($_TABLES['users'], "fullname", "uid='$uid'");

    $retval .= '<tr>
        <td align="right"><b>Full Name:</b></td>
        <td><input type="text" name="cust_fullname" size="50" value="' . $fullname .'"></td>
     </tr>';
    $retval .= '<tr>
        <td align="right"><b>Graduation Year:</b></td>
        <td><input type="text" name="cust_gradyear" size="5" maxlength="4" value="' . $grad_year .'"></td>
     </tr>';
    $retval .= '<tr><td colspan="2"><hr></td></tr>';
   return $retval;
}


/* Function called when saving the user profile. */
/* This function can now update any extra fields  */
function custom_usersave($uid) {
    global $_TABLES;

    $grad_year = COM_applyFilter($_POST['cust_gradyear'],true);
    $fullname  = COM_applyFilter($_POST['fullname']);

    DB_query("UPDATE {$_TABLES['users']} SET fullname='$fullname' WHERE uid='$uid'");
    if ($grad_year > 0) {
        DB_query("UPDATE {$_TABLES['localuserinfo']} SET grad_year='$grad_year' WHERE uid='$uid'");
    }

}


/**
* Main Form used for Custom membership when member is registering
*
* Note: Requires a file custom/memberdetail.thtml in every theme that is
*       installed on the site!
*
* @param    string  $msg    an error message to display or the word 'new'
* @return   string          HTML for the registration form
*
*/
function custom_userform($uid="",$msg="") {
    global $_CONF,$_TABLES, $LANG04;

    if (!empty($msg)) {
        $retval .= COM_startBlock($LANG04[21]) . $msg . COM_endBlock();
    }

    $post_url = $_CONF['site_url']."/users.php";
    $postmode = "create";
    $submitbutton = '<input type="submit" value="Register Now!">';
    $passwd_input = "";
    $message = "<br><font color=black><b>Please complete the application below. Once you have completed the application, click the Submit button and the application will be processed immediately.</b></font>";
    $A=array();

    $user_templates = new Template ($_CONF['path_layout'] . 'custom');
    $user_templates->set_file('memberdetail', 'memberdetail.thtml');
    $user_templates->set_var('layout_url', $_CONF['layout_url']);
    $user_templates->set_var('post_url', $post_url);
    $user_templates->set_var('startblock', COM_startBlock("Custom Registration Example"));
    $user_templates->set_var('message', $message);    
    $user_templates->set_var('USERNAME', "Username");
    $user_templates->set_var('USERNAME_HELP', "Name to be used when accessing this site");
    $user_templates->set_var('username', $A['username']);
    $user_templates->set_var('passwd_input', $passwd_input);
    $user_templates->set_var('EMAIL', "Email Address");
    $user_templates->set_var('EMAIL_HELP', "Valid email address");
    $user_templates->set_var('email', $A['email']);
    $user_templates->set_var('FULLNAME', "Full Name");
    $user_templates->set_var('FULLNAME_HELP', "First and Last Name");
    $user_templates->set_var('fullname', $A['fullname']);
    $user_templates->set_var('GRADYEAR', "Graduation Year");
    $user_templates->set_var('GRADYEAR_HELP', "That big year!");
    $user_templates->set_var('grad_year', "");
    $user_templates->set_var('user_id', $user);
    $user_templates->set_var('postmode', $postmode);
    $user_templates->set_var('submitbutton', $submitbutton);
    $user_templates->set_var('endblock', COM_endBlock());
    $user_templates->parse('output', 'memberdetail');
    $retval .= $user_templates->finish($user_templates->get_var('output'));

    return $retval;
}

/**
* Check if it's okay to create a new user.
*
* Geeklog is about to create a new user with the given username and email
* address. This is the custom code's last chance to prevent that,
* e.g. to check if all required data has been entered.
*
* @param    string  $username   username that Geeklog would use for the new user* @param    string  $email      email address of that user
* @return   string              an error message or an empty string for "OK"
*
*/
function custom_usercheck ($username, $email)
{
    $msg = '';

    // Example, check that the full name has been entered
    // and complain if it's missing
    if (empty ($_POST['fullname'])) {
        $msg = 'Please enter your full name!';
    }

    return $msg;
}


/**
* Custom function to retrieve and return a formatted list of blocks
* Can be used when calling COM_siteHeader or COM_SiteFooter

* Example:
* 1: Setup an array of blocks to display
* 2: Call COM_siteHeader or COM_siteFooter
*
*  $myblocks = array ('site_menu','site_news','poll_block');

* COM_siteHeader( array('COM_showCustomBlocks',$myblocks) ) ;
* COM_siteFooter( true, array('COM_showCustomBlocks',$myblocks));

* @param   array   $showblocks    An array of block names to retrieve and format
* @return  string                 Formated HTML containing site footer and optionally right blocks
*/
function custom_showBlocks($showblocks)
{
    global $_CONF, $_TABLES;

    $retval = '';
    foreach($showblocks as $block) {
        $sql = "SELECT bid, name,type,title,content,rdfurl,phpblockfn,help FROM {$_TABLES['blocks']} WHERE name='$block'";
        $result = DB_query($sql);
        if (DB_numRows($result) == 1) {
            $A = DB_fetchArray($result);
            $retval .= COM_formatBlock($A);
        }
    }

    return $retval;
}


/**
* This is an example of a custom email function. When this function is NOT
* commented out, Geeklog would send all emails through this function
* instead of sending them through COM_mail in lib-common.php.
*
* This is basically a re-implementation of the way emails were sent
* prior to Geeklog 1.3.9 (Geeklog uses PEAR::Mail as of version 1.3.9).
*
*/
/*
function CUSTOM_mail($to, $subject, $message, $from = '', $html = false, $priority = 0)
{
    global $_CONF, $LANG_CHARSET;

    if (empty ($LANG_CHARSET)) {
        $charset = $_CONF['default_charset'];
        if (empty ($charset)) {
            $charset = 'iso-8859-1';
        }
    } else {
        $charset = $LANG_CHARSET;
    }

    if (empty ($from)) {
        $from = $_CONF['site_name'] . ' <' . $_CONF['site_mail'] . '>';
    }

    $headers  = 'From: ' . $from . "rn"
              . 'X-Mailer: Geeklog ' . VERSION . "rn";

    if ($priority > 0) {
        $headers .= 'X-Priority: ' . $priority . "rn";
    }

    if ($html) {
        $headers .= "Content-Type: text/html; charset={$charset}rn"
                 .  'Content-Transfer-Encoding: 8bit';
    } else {
        $headers .= "Content-Type: text/plain; charset={$charset}";
    }

    return mail ($to, $subject, $message, $headers);
}
*/

/**
* This is an example of a function that returns menu entries to be used for
* the 'custom' entry in $_CONF['menu_elements'] (see config.php).
*
*/
/*
function CUSTOM_menuEntries ()
{
    global $_CONF, $_USER;

    $myentries = array ();

    // Sample link #1: Link to Gallery
    $myentries[] = array ('url'   => $_CONF['site_url'] . '/gallery/',
                          'label' => 'Gallery');

    // Sample link #2: Link to the Personal Calendar - only visible for
    // logged-in users
    if (!empty ($_USER['uid']) && ($_USER['uid'] > 1)) {
        $myentries[] = array ('url'   => $_CONF['site_url']
                                         . '/calendar.php?mode=personal',
                              'label' => 'My Calendar');
    }

    return $myentries;
}
*/

?>
 


All the fields seem to be present at time of registrattion but GL won't accept the new user in info once submitted. Just refreshes the screen and the fields are then blank again.

here is the link, here

Not sure what to do here. copied all for the functions from the included lib-custom code file into my lib-custom but I am not sure i did it correctly. I beliee that there were some opening and closing php tags in that file atha I did not use. That one step seemed vauge to me.

If you can help me ith this that would be great.

Jordy
 Quote

jarod

Anonymous
hi Jordy Smile

how did you get your phpbb bridge to allow you to attach images?

mine only lets linking to images... Can someone help me

am i missing something?

thanks in advance,
jarod
 Quote

Status: offline

jordydme

Forum User
Full Member
Registered: 11/03/05
Posts: 135
Jarod,

There is a cool Mod that allows you to do it. Check it out here
 Quote

jarod

Anonymous
Big Celebration thanks alot!

i will check it out asap..

thanks again,
jarod
 Quote

All times are EDT. The time is now 03:27 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content