Changeset 24 for trunk/includes

Show
Ignore:
Timestamp:
08/19/05 00:34:27 (7 years ago)
Author:
alexx
Message:
  • add Meta Album feature (to link .node profile with external album on Flickr or interAlbum.com)
  • change method to find BASEPATH (to be more reliable)
  • add Meta Album link to profile page (to be modified later)
  • modify default data for db (old data isn't good with cache)
  • add is_valid function to .... valid things ;)
  • add config param for flickr api_key
  • DB: modify database structure to add metalbum table
    CREATE TABLE `metalbum` (
    `id` varchar(32) NOT NULL default '',
    `type` varchar(16) NOT NULL default '',
    `login` varchar(64) NOT NULL default '',
    `nb_items` int(10) unsigned default NULL,
    PRIMARY KEY  (`id`,`type`,`login`)
    ) TYPE=MyISAM;
    
Location:
trunk/includes
Files:
4 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/includes/EDIT_config_server.inc.php

    r10 r24  
    4545); 
    4646 
     47// Get it on http://www.flickr.com/services/api/key.gne 
     48$config['metalbum']['flickr']['api_key'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; 
     49 
    4750?> 
  • trunk/includes/config.inc.php

    r16 r24  
    2323 ******************** http://opensource.ikse.net/projects/dotnode ***/ 
    2424 
    25 if(array_key_exists('DOCUMENT_ROOT', $_SERVER) && strlen($_SERVER['DOCUMENT_ROOT']) > 0) 
    26         define('BASEPATH',$_SERVER['DOCUMENT_ROOT']); 
    27 elseif(array_key_exists('BASEPATH', $_ENV)) 
    28         define('BASEPATH', $_ENV['BASEPATH']); 
     25define('BASEPATH', dirname(__FILE__).'/../www'); 
    2926 
    3027define('INCLUDESPATH', BASEPATH.'/../includes'); 
  • trunk/includes/functions.inc.php

    r21 r24  
    450450} 
    451451 
     452function is_valid($type, $string) 
     453{ 
     454        global $labels; 
     455        switch($type) 
     456        { 
     457        case 'login': 
     458                return valid_login($string); 
     459                break; 
     460        case 'email': 
     461                return valid_email($string); 
     462                break; 
     463        case 'lang': 
     464                return valid_lang($lang); 
     465                break; 
     466        case 'user_id': 
     467                return ereg("[a-f0-9]{32}", $string); 
     468                break; 
     469        case 'metalbum_type': 
     470                if(in_array($string, array_keys($labels['metalbum']['type']))) 
     471                        return true; 
     472                else 
     473                        return false; 
     474                break; 
     475        case 'metalbum_name': 
     476                if(strpos($string, '@')) 
     477                { 
     478                        list($login, $type) = split('@', $string); 
     479                        if(ereg("[a-zA-Z0-9_-]{2,32}", $login) && is_valid('metalbum_type', $type)) 
     480                                return true; 
     481                } 
     482                else 
     483                        return false; 
     484                break; 
     485        } 
     486} 
     487 
    452488function valid_login($login) 
    453489{ 
  • trunk/includes/labels.inc.php

    r1 r24  
    218218        'stop' => tr('Operation stopped'), 
    219219        'error' => tr('Error') ); 
     220         
     221$labels['metalbum']['type'] = array( 
     222        'interalbum' => 'interAlbum.com', 
     223        'flickr' => 'Flickr.com' ); 
    220224 
    221225?>