Ejemplo n.º 1
0
     $partnerObj->setVar('image_url', $_POST['image_url']);
     $partnerObj->setVar('description', $_POST['description']);
     $partnerObj->setVar('contact_name', $_POST['contact_name']);
     $partnerObj->setVar('contact_email', $_POST['contact_email']);
     $partnerObj->setVar('contact_phone', $_POST['contact_phone']);
     $partnerObj->setVar('adress', $_POST['adress']);
     $partnerObj->setVar('url', $_POST['url']);
     $partnerObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : 0);
     $partnerObj->setVar('email_priv', isset($_POST['email_priv']) ? intval($_POST['email_priv']) : 0);
     $partnerObj->setVar('phone_priv', isset($_POST['phone_priv']) ? intval($_POST['phone_priv']) : 0);
     $partnerObj->setVar('adress_priv', isset($_POST['adress_priv']) ? intval($_POST['adress_priv']) : 0);
     $partnerObj->setVar('showsummary', isset($_POST['showsummary']) ? intval($_POST['showsummary']) : 0);
     $redirect_msgs = $partnerObj->getRedirectMsg($_POST['original_status'], $_POST['status']);
     // Storing the partner
     if (!$partnerObj->store()) {
         redirect_header("javascript:history.go(-1)", 3, $redirect_msgs['error'] . smartpartner_formatErrors($partnerObj->getErrors()));
         exit;
     }
     if ($_POST['original_status'] == _SPARTNER_STATUS_SUBMITTED || $_POST['status'] == _SPARTNER_STATUS_ACTIVE) {
         $partnerObj->sendNotifications(array(_SPARTNER_NOT_PARTNER_APPROVED));
     }
     if ($partnerObj->isNew()) {
         $partnerObj->sendNotifications(array(_SPARTNER_NOT_PARTNER_NEW));
     }
     redirect_header("partner.php", 2, $redirect_msgs['success']);
     exit;
     break;
 case "del":
     global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
     $module_id = $xoopsModule->getVar('mid');
     $gperm_handler =& xoops_gethandler('groupperm');
Ejemplo n.º 2
0
function smartpartner_upload_file($another = false, $withRedirect = true, &$itemObj)
{
    include_once SMARTPARTNER_ROOT_PATH . "class/uploader.php";
    global $smartpartner_isAdmin, $xoopsModuleConfig, $smartpartner_partner_handler, $smartpartner_file_handler, $xoopsUser;
    $id = isset($_POST['id']) ? intval($_POST['id']) : 0;
    $uid = is_object($xoopsUser) ? $xoopsUser->uid() : 0;
    $session = SmartpartnerSession::singleton();
    $session->set('smartpartner_file_filename', isset($_POST['name']) ? $_POST['name'] : '');
    $session->set('smartpartner_file_description', isset($_POST['description']) ? $_POST['description'] : '');
    $session->set('smartpartner_file_status', $_POST['file_status']);
    $session->set('smartpartner_file_uid', $uid);
    $session->set('smartpartner_file_id', $id);
    if (!is_object($itemObj)) {
        $itemObj = $smartpartner_partner_handler->get($id);
    }
    $max_size = $xoopsModuleConfig['maximum_filesize'];
    $fileObj = $smartpartner_file_handler->create();
    $fileObj->setVar('name', isset($_POST['name']) ? $_POST['name'] : '');
    $fileObj->setVar('description', isset($_POST['description']) ? $_POST['description'] : '');
    $fileObj->setVar('status', isset($_POST['file_status']) ? intval($_POST['file_status']) : 1);
    $fileObj->setVar('uid', $uid);
    $fileObj->setVar('id', $itemObj->getVar('id'));
    $allowed_mimetypes = '';
    $errors = '';
    // Get available mimetypes for file uploading
    /*    $hMime =& xoops_getmodulehandler('mimetype');
        if ($smartpartner_isAdmin) {
            $crit = new Criteria('mime_admin', 1);
        } else {
            $crit = new Criteria('mime_user', 1);
        }
        $mimetypes =& $hMime->getObjects($crit);
        // TODO : display the available mimetypes to the user
    	*/
    if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
        if (!($ret = $fileObj->checkUpload('userfile', $allowed_mimetypes, $errors))) {
            $errorstxt = implode('<br />', $errors);
            $message = sprintf(_SMARTPARTNER_MESSAGE_FILE_ERROR, $errorstxt);
            if ($withRedirect) {
                redirect_header("file.php?op=mod&id=" . $id, 5, $message);
            } else {
                return $message;
            }
        }
    }
    // Storing the file
    if (!$fileObj->store($allowed_mimetypes)) {
        if ($withRedirect) {
            redirect_header("file.php?op=mod&id=" . $fileObj->id(), 3, _AM_SPARTNER_FILEUPLOAD_ERROR . smartpartner_formatErrors($fileObj->getErrors()));
            exit;
        } else {
            return _AM_SPARTNER_FILEUPLOAD_ERROR . smartpartner_formatErrors($fileObj->getErrors());
        }
    }
    if ($withRedirect) {
        $redirect_page = $another ? 'file.php' : 'partner.php';
        redirect_header($redirect_page . "?op=mod&id=" . $fileObj->id(), 2, _AM_SPARTNER_FILEUPLOAD_SUCCESS);
    } else {
        return true;
    }
}
Ejemplo n.º 3
0
         $redirect_msg = _AM_SPARTNER_CATEGORY_MODIFIED;
         $redirect_to = 'category.php';
     }
     if (!$categoryObj->store()) {
         redirect_header("javascript:history.go(-1)", 3, _AM_SPARTNER_CATEGORY_SAVE_ERROR . smartpartner_formatErrors($categoryObj->getErrors()));
         exit;
     }
     //Added by fx2024
     $parentCat = $categoryObj->categoryid();
     for ($i = 0; $i < sizeof($_POST['scname']); $i++) {
         if ($_POST['scname'][$i] != '') {
             $categoryObj = $smartpartner_category_handler->create();
             $categoryObj->setVar('name', $_POST['scname'][$i]);
             $categoryObj->setVar('parentid', $parentCat);
             if (!$categoryObj->store()) {
                 redirect_header("javascript:history.go(-1)", 3, _AM_SPARTNER_CATEGORY_SUBCAT_SAVE_ERROR . smartpartner_formatErrors($categoryObj->getErrors()));
                 exit;
             }
         }
     }
     //end of fx2024 code
     redirect_header($redirect_to, 2, $redirect_msg);
     exit;
     break;
     //Added by fx2024
 //Added by fx2024
 case "addsubcats":
     $categoryid = 0;
     $nb_subcats = intval($_POST['nb_subcats']) + $_POST['nb_sub_yet'];
     smartpartner_xoops_cp_header();
     $categoryObj =& $smartpartner_category_handler->create();
Ejemplo n.º 4
0
     $partnerObj->setVar('adress', $_POST['adress']);
     $partnerObj->setVar('url', $_POST['url']);
     $partnerObj->setVar('image_url', $_POST['image_url']);
     $partnerObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : 0);
     $partnerObj->setVar('status', _SPARTNER_STATUS_SUBMITTED);
     $partnerObj->setVar('email_priv', isset($_POST['email_priv']) ? intval($_POST['email_priv']) : 0);
     $partnerObj->setVar('phone_priv', isset($_POST['phone_priv']) ? intval($_POST['phone_priv']) : 0);
     $partnerObj->setVar('adress_priv', isset($_POST['adress_priv']) ? intval($_POST['adress_priv']) : 0);
     if ($xoopsModuleConfig['autoapprove_submitted']) {
         $partnerObj->setVar('status', _SPARTNER_STATUS_ACTIVE);
     } else {
         $partnerObj->setVar('status', _SPARTNER_STATUS_SUBMITTED);
     }
     // Storing the partner
     if (!$partnerObj->store()) {
         redirect_header("javascript:history.go(-1)", 3, _MD_SPARTNER_SUBMIT_ERROR . smartpartner_formatErrors($partnerObj->getErrors()));
         exit;
     }
     if (isset($_POST['notifypub']) && $_POST['notifypub'] == 1) {
         include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
         $notification_handler =& xoops_gethandler('notification');
         $notification_handler->subscribe('partner', $partnerObj->id(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
     }
     $partnerObj->sendNotifications(array(_SPARTNER_NOT_PARTNER_SUBMITTED));
     redirect_header("index.php", 3, _MD_SPARTNER_SUBMIT_SUCCESS);
     exit;
     break;
 case "form":
     if ($xoopsModuleConfig['allowsubmit'] != 1 || !$xoopsUser && $xoopsModuleConfig['anonpost'] != 1) {
         redirect_header("index.php", 2, _NOPERM);
     }
Ejemplo n.º 5
0
 case "modify":
     global $xoopsUser;
     $fileid = isset($_POST['fileid']) ? intval($_POST['fileid']) : 0;
     // Creating the file object
     if ($fileid != 0) {
         $fileObj = new SmartpartnerFile($fileid);
     } else {
         $fileObj = $smartpartner_file_handler->create();
     }
     // Putting the values in the file object
     $fileObj->setVar('name', $_POST['name']);
     $fileObj->setVar('description', $_POST['description']);
     $fileObj->setVar('status', intval($_POST['file_status']));
     // Storing the file
     if (!$fileObj->store()) {
         redirect_header("partner.php?op=mod&id=" . $fileObj->id(), 3, _AM_SPARTNER_FILE_EDITING_ERROR . smartpartner_formatErrors($fileObj->getErrors()));
         exit;
     }
     redirect_header("partner.php?op=mod&id=" . $fileObj->id(), 2, _AM_SPARTNER_FILE_EDITING_SUCCESS);
     exit;
     break;
 case "del":
     global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
     $module_id = $xoopsModule->getVar('mid');
     $gperm_handler =& xoops_gethandler('groupperm');
     $fileid = isset($_POST['fileid']) ? intval($_POST['fileid']) : 0;
     $fileid = isset($_GET['fileid']) ? intval($_GET['fileid']) : $fileid;
     $fileObj = new SmartpartnerFile($fileid);
     $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
     $title = isset($_POST['title']) ? $_POST['title'] : '';
     if ($confirm) {