Пример #1
0
 public function access_protected_resource()
 {
     global $CONFIG, $THEME_DIR, $USER, $CAT_LIST;
     global $cpg_udb;
     // Needed for "lastcomby" meta album in picture list
     try {
         $result = $this->verify('access');
         if ($result != null) {
             define('API_CALL', true);
             $superCage = Inspekt::makeSuperCage();
             $matches = $superCage->post->getMatched('function', '/^[a-z]+$/');
             switch ($matches[0]) {
                 case 'upload':
                     require 'db_input.php';
                     break;
                 case 'alblist':
                     define('IN_COPPERMINE', true);
                     require 'include/init.inc.php';
                     pub_user_albums();
                     upload_form_alb_list('', '');
                     break;
                 case 'piclist':
                     define('IN_COPPERMINE', true);
                     require 'include/init.inc.php';
                     if ($superCage->post->getInt('album')) {
                         pub_user_albums();
                         upload_form_alb_list('', '');
                     } else {
                         if ($album = $superCage->post->getAlpha('album')) {
                             $allowed = array('lastcom', 'lastcomby', 'lastup', 'lastupby', 'topn', 'toprated', 'lasthits');
                             if (!in_array($album, $allowed)) {
                                 new OAuthException("Valid meta album names for this function are: 'lastcom', 'lastcomby', 'lastup', 'lastupby', 'topn', 'toprated', and 'lasthits'");
                             }
                             $USER['uid'] = USER_ID;
                             require 'thumbnails.php';
                         } else {
                             // No album provided
                             new OAuthException('No album provided via HTTP POST');
                         }
                     }
                     break;
                 case 'search':
                     define('IN_COPPERMINE', true);
                     require 'include/init.inc.php';
                     require 'thumbnails.php';
                     break;
                 case 'catlist':
                     define('IN_COPPERMINE', true);
                     require 'include/init.inc.php';
                     api_cat_list();
                     break;
                 default:
                     throw new OAuthException('No function specified via HTTP POST');
             }
         }
     } catch (OAuthException $e) {
         header('HTTP/1.1 401 Access Denied');
         header('Content-Type: text/xml');
         throw new OAuthException($e->getMessage());
     }
     OAuthRequestLogger::flush();
     exit;
 }
Пример #2
0
        }
    }
} else {
    //Use the default settings for the number of boxes.
    $num_URI_boxes = NUM_URI_BOXES;
    $num_file_boxes = NUM_FILE_BOXES;
}
if (empty($num_URI_boxes) && empty($num_file_boxes)) {
    $num_URI_boxes = 0;
    $num_file_boxes = 1;
}
//send the number of amx files and url to jUpload.js
set_js_var('maxFiles', $num_file_boxes);
set_js_var('maxUrls', $num_URI_boxes);
// Get public and private albums, and set maximum individual file size.
pub_user_albums();
global $public_albums_list, $user_albums_list;
if (!count($public_albums_list) && !count($user_albums_list)) {
    // there's no album where the user is allowed to upload to
    if (USER_CAN_CREATE_ALBUMS) {
        // cpg_die (ERROR, $lang_upload_php['err_no_alb_uploadables'].'<br />&nbsp;<br /><a href="albmgr.php" title="'.$lang_user_admin_menu['albmgr_title'].'" class="admin_menu">'.$lang_user_admin_menu['albmgr_lnk'].'</a>', __FILE__, __LINE__);
    } else {
        cpg_die(ERROR, $lang_upload_php['err_no_alb_uploadables'], __FILE__, __LINE__);
    }
}
// Assign maximum file size for browser crontrols.
$max_file_size = $CONFIG['max_upl_size'] << 10;
// Create the upload forms using the upload congfiguration.
if (!$superCage->post->keyExists('control')) {
    // Do some cleanup in the edit directory.
    spring_cleaning('./' . $CONFIG['fullpath'] . 'edit', CPG_HOUR);