예제 #1
0
/** Create a whitelist of valid values, be sure to use appropriate types for each value
 * Be sure to include a value for no parameter, if you have a default condition
 */
$valid_op = array('mod', 'changedField', 'del', '');
/**
 * in_array() is a native PHP function that will determine if the value of the
 * first argument is found in the array listed in the second argument. Strings
 * are case sensitive and the 3rd argument determines whether type matching is
 * required
*/
if (in_array($clean_op, $valid_op, true)) {
    switch ($clean_op) {
        case "mod":
        case "changedField":
            icms_cp_header();
            editaudio($clean_audio_id);
            break;
        case "del":
            $controller = new icms_ipf_Controller($profile_audio_handler);
            $controller->handleObjectDeletion();
            break;
        default:
            icms_cp_header();
            icms::$module->displayAdminMenu(9, _AM_PROFILE_AUDIOS);
            $objectTable = new icms_ipf_view_Table($profile_audio_handler);
            $objectTable->addColumn(new icms_ipf_view_Column('audio_id'));
            $objectTable->addColumn(new icms_ipf_view_Column('uid_owner', false, false, 'getAudioSender'));
            $objectTable->addColumn(new icms_ipf_view_Column('author'));
            $objectTable->addColumn(new icms_ipf_view_Column('title', _GLOBAL_LEFT, false, 'getAudioTitle'));
            $objectTable->addColumn(new icms_ipf_view_Column('creation_time'));
            $objectTable->addColumn(new icms_ipf_view_Column('url', 'center', 330, 'getAudioToDisplay', false, false, false));
예제 #2
0
     if ($audioObj->isNew() || !$audioObj->userCanEditAndDelete()) {
         redirect_header(PROFILE_URL . basename(__FILE__), 3, _NOPERM);
     }
     if (isset($_POST['confirm'])) {
         if (!icms::$security->check()) {
             redirect_header(icms_getPreviousPage('index.php'), 3, _MD_PROFILE_SECURITY_CHECK_FAILED . implode('<br />', icms::$security->getErrors()));
         }
     }
     $controller = new icms_ipf_Controller($profile_audio_handler);
     $controller->handleObjectDeletionFromUserSide();
     $icmsTpl->assign('profile_category_path', $audioObj->getVar('title') . ' > ' . _DELETE);
     break;
 default:
     $clean_start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
     if ($real_uid && $real_uid == $uid) {
         editaudio($audioObj, true);
     }
     if ($clean_uid > 0 || $real_uid > 0) {
         $uid = $clean_uid > 0 ? $clean_uid : $real_uid;
         $audiosArray = $profile_audio_handler->getAudios($clean_start, icms::$module->config['audiosperpage'], $uid);
         if (count($audiosArray) == 0) {
             $icmsTpl->assign('lang_nocontent', _MD_PROFILE_AUDIOS_NOCONTENT);
         } else {
             $total_audios_count = $profile_audio_handler->getCount(new icms_db_criteria_Compo(new icms_db_criteria_Item('uid_owner', $uid)));
             $pagenav = new icms_view_PageNav($total_audios_count, icms::$module->config['audiosperpage'], $clean_start, 'start', 'uid=' . $uid);
             $icmsTpl->assign('profile_audios_pagenav', $pagenav->renderNav());
             $icmsTpl->assign('profile_audios', $audiosArray);
             unset($total_audios_count, $pagenav);
         }
     } else {
         redirect_header(PROFILE_URL);