コード例 #1
0
    /**
     * Get array of contacts data by Email
     *
     * @param string $data
     * @return array of CMS_profile_user
     * @access public
     */
    static function getByEmail($data)
    {
        if (!SensitiveIO::isValidEmail($data)) {
            CMS_grandFather::raiseError('$data must be a valid email : ' . $data);
            return array();
        }
        $aUsers = array();
        //create the request to look for the data
        $sql = 'select `id_cd` 
			from `contactDatas`
			where `email_cd` = "' . sensitiveIO::sanitizeSQLString($data) . '"';
        //launching the request
        $q = new CMS_query($sql);
        //checking if ok and looping on results
        if (!$q->hasError()) {
            while (($oTmpUserId = $q->getValue("id_cd")) !== false) {
                //creating the user and filling the data
                $oTmpUser = CMS_profile_usersCatalog::getByID($oTmpUserId);
                if (!$oTmpUser->hasError()) {
                    $oTmpUser->getContactData();
                    if (!$oTmpUser->hasError()) {
                        $aUsers[] = $oTmpUser;
                    }
                }
            }
            unset($oTmpUser, $oTmpUserId);
        }
        return $aUsers;
    }
コード例 #2
0
ファイル: emailscatalog.php プロジェクト: davidmottet/automne
 /**
  * @param array(CMS_users) $users users to send message to
  * @param array(CMS_profile_user) $users
  * @param array($language=>$subject) $messages indexed by languages code
  * @param array($language=>$subject) $subjects indexed by languages code
  * @param integer $alertLevel
  * @return void
  * @access public
  */
 function setUserMessages($users, $messages, $subjects, $alertLevel = ALERT_LEVEL_VALIDATION, $module = MOD_STANDARD_CODENAME)
 {
     $mainURL = CMS_websitesCatalog::getMainURL();
     $template = is_file(PATH_MAIL_TEMPLATES_FS) ? PATH_MAIL_TEMPLATES_FS : '';
     foreach ($users as $user) {
         //if is integer create user object
         if (!is_a($user, "CMS_user_profile") && SensitiveIO::isPositiveInteger($user)) {
             $user = CMS_profile_usersCatalog::getByID($user);
         }
         //if user hasn't alert level for this module or user is not active anymore, skip it
         if (!$user->hasAlertLevel($alertLevel, $module) || $user->isDeleted() || !$user->isActive()) {
             //CMS_grandFather::raiseError('user '.$user->getFullName().' has no alerts for level '.$alertLevel.' for module '.$module);
             continue;
         }
         $userLang = $user->getLanguage();
         $email = new CMS_email();
         if ($user->getEmail()) {
             if ($email->setEmailTo($user->getEmail())) {
                 $email->setSubject($subjects[$userLang->getCode()], true);
                 $email->setBody($messages[$userLang->getCode()]);
                 $email->setFooter($userLang->getMessage(self::MESSAGE_EMAIL_BODY_URLS, array(APPLICATION_LABEL, $mainURL . "/", $mainURL . PATH_ADMIN_WR . "/")));
                 $email->setTemplate($template);
                 $this->_messages[] = $email;
             } else {
                 $this->raiseError("Email Catalog: email invalid (" . $user->getEmail() . ") for user : " . $user->getFullName());
             }
         }
     }
 }
コード例 #3
0
}
if ($objectId && (!isset($object) || $object->hasError())) {
    CMS_grandFather::raiseError('Error, objectId does not exists or has an error : ' . $objectId);
    $view->setContent($content);
    $view->show();
}
if (isset($object)) {
    //load item if any
    if ($itemId) {
        $item = new CMS_poly_object($objectId, $itemId);
        if ($action == 'save' || $action == 'save-validate') {
            $itemLabel = sensitiveIO::sanitizeJSString($item->getLabel());
            if ($object->isPrimaryResource()) {
                //put a lock on the resource or warn user if item is already locked by another user
                if ($lock = $item->getLock()) {
                    $lockUser = CMS_profile_usersCatalog::getById($lock);
                    if ($lockUser->getUserId() != $cms_user->getUserId()) {
                        $lockDate = $item->getLockDate();
                        $date = $lockDate ? $lockDate->getLocalizedDate($cms_language->getDateFormat() . ' @ H:i:s') : '';
                        $name = sensitiveIO::sanitizeJSString($lockUser->getFullName());
                        CMS_grandFather::raiseError('Error, item ' . $itemId . ' is locked by ' . $lockUser->getFullName());
                        $jscontent = "\n\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\tmsg: \t\t\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_ELEMENT_LOCKED, array($itemLabel, $name, $date), MOD_POLYMOD_CODENAME)}',\n\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OK,\n\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.ERROR\n\t\t\t\t\t\t});";
                        $view->addJavascript($jscontent);
                        $view->setContent($content);
                        $view->show();
                    }
                } else {
                    $item->lock($cms_user);
                }
            }
            //check user rights on item
コード例 #4
0
ファイル: resource.php プロジェクト: davidmottet/automne
 /**
  * Get the editors for an edition, or all the editors if no edition given.
  *
  * @param integer $edition We want the editors that edited this edition, or all if it's set to false
  * @return array(CMS_profile_user) The users, or an empty array if none found
  * @access public
  */
 function getEditors($edition = false)
 {
     if ($edition) {
         $usersIDs = $this->_editors->getElementsWithOneValue($edition, 2);
     } else {
         $usersIDs = $this->_editors->getElements();
     }
     $users = array();
     foreach ($usersIDs as $userID) {
         $user = CMS_profile_usersCatalog::getByID($userID[0]);
         if (is_a($user, 'CMS_profile_user') && !$user->hasError()) {
             $users[] = $user;
         }
     }
     return $users;
 }
コード例 #5
0
ファイル: form.php プロジェクト: davidmottet/automne
 /**
  * Get the resource's owner
  * 
  * @access public
  * @return CMS_profile_user, or null if none found
  */
 function getOwner()
 {
     if ($this->_ownerID > 0) {
         return CMS_profile_usersCatalog::getByID($this->_ownerID);
     } else {
         return null;
     }
 }
コード例 #6
0
ファイル: object_email.php プロジェクト: davidmottet/automne
 /**
  * Get all selected recipients for the field
  * @return array of usersIds which are recipients of the notification
  * @access public
  */
 private function _getRecipients($objectID)
 {
     $params = $this->getParamsValues();
     $recipients = array();
     if (isset($params['usersGroupsField']) && $params['usersGroupsField']) {
         //instanciate related item
         $item = CMS_poly_object_catalog::getObjectByID($objectID, false, true);
         if (!is_object($item) || $item->hasError()) {
             return $recipients;
         }
         //does selected field represent users or groups ?
         $field = new CMS_poly_object_field($params['usersGroupsField']);
         $isGroup = $field->getParameter('isGroup');
         //get item field value
         $ids = $item->objectValues($params['usersGroupsField'])->getValue('ids');
         if (!$ids) {
             return array();
         }
         //get users ids
         if ($isGroup) {
             foreach ($ids as $groupId) {
                 $usersIds = CMS_profile_usersGroupsCatalog::getGroupUsers($groupId, false);
                 foreach ($usersIds as $userId) {
                     $recipients[$userId] = $userId;
                 }
             }
         } else {
             $recipients = $ids;
         }
     } else {
         //get all active users ids
         $allUsers = CMS_profile_usersCatalog::getAll(true, false, false);
         //check if user is in included or excluded parameters lists
         $selectedGroups = $params['disableGroups'] ? explode(';', $params['disableGroups']) : array();
         $selectedUsers = $params['disableUsers'] ? explode(';', $params['disableUsers']) : array();
         //check all users to see if it match selection parameters
         foreach ($allUsers as $userId) {
             if ($params['includeExclude']) {
                 //user must be in selected groups or users to get email
                 $userSelected = false;
                 if (is_array($selectedGroups) && $selectedGroups) {
                     foreach ($selectedGroups as $groupId) {
                         if (CMS_profile_usersGroupsCatalog::userBelongsToGroup($userId, $groupId)) {
                             $userSelected = true;
                         }
                     }
                 }
                 if (is_array($selectedUsers) && $selectedUsers && in_array($userId, $selectedUsers)) {
                     $userSelected = true;
                 }
             } else {
                 //user must NOT be in selected groups or users to get email
                 $userSelected = true;
                 if (is_array($selectedGroups) && $selectedGroups) {
                     foreach ($selectedGroups as $groupId) {
                         if (CMS_profile_usersGroupsCatalog::userBelongsToGroup($userId, $groupId)) {
                             $userSelected = false;
                         }
                     }
                 }
                 if (is_array($selectedUsers) && $selectedUsers && in_array($userId, $selectedUsers)) {
                     $userSelected = false;
                 }
             }
             if ($userSelected) {
                 $recipients[] = $userId;
             }
         }
     }
     return $recipients;
 }
コード例 #7
0
 /**
  * Gets the users for a group
  * Static function.
  * 
  * @param integer $groupID
  * @param boolean returnObjects : return CMS_profile_user objects (default) or array of userId
  * @access public
  */
 static function getGroupUsers($groupID, $returnObjects = true)
 {
     $sql = "\n\t\t\tselect\n\t\t\t\tid_pru\n\t\t\tfrom\n\t\t\t\tprofilesUsers,\n\t\t\t\tprofileUsersByGroup\n\t\t\twhere\n\t\t\t\tuserId_gu=id_pru\n\t\t\t\tand deleted_pru=0\n\t\t\t\tand groupId_gu='" . SensitiveIO::sanitizeSQLString($groupID) . "'\n\t\t\torder by\n\t\t\t\tlastName_pru,\n\t\t\t\tfirstName_pru\n\t\t";
     $q = new CMS_query($sql);
     $users = array();
     while ($id = $q->getValue("id_pru")) {
         if ($returnObjects) {
             $usr = CMS_profile_usersCatalog::getByID($id);
             if (is_a($usr, "CMS_profile_user") && !$usr->hasError()) {
                 $users[$id] = $usr;
             }
         } else {
             $users[$id] = $id;
         }
     }
     return $users;
 }
コード例 #8
0
ファイル: poly_object.php プロジェクト: davidmottet/automne
 /**
  * Module script task
  * @param array $parameters the task parameters
  *		task : string task to execute
  *		object : string module codename for the task
  *		field : string module uid
  *		...	: optional field relative parameters
  * @return Boolean true/false
  * @access public
  */
 function scriptTask($parameters)
 {
     //if script concern a field, pass to it
     if (isset($parameters['field']) && sensitiveIO::isPositiveInteger($parameters['field'])) {
         if (!is_object($this->_objectValues[$parameters['field']]) || !method_exists($this->_objectValues[$parameters['field']], 'scriptTask')) {
             return false;
         }
         //then pass task to field
         return $this->_objectValues[$parameters['field']]->scriptTask($parameters);
     } else {
         //this is an object related script
         switch ($parameters['task']) {
             case 'emailNotification':
                 //instanciate user
                 $user = CMS_profile_usersCatalog::getByID($parameters['validator']);
                 if ($this->userHasClearance($user, CLEARANCE_MODULE_EDIT)) {
                     //get Object definition
                     $objectDef = $this->getObjectDefinition();
                     //get module
                     $codename = CMS_poly_object_catalog::getModuleCodenameForObjectType($objectDef->getID());
                     switch ($parameters['type']) {
                         case 'validate':
                             $group_email = new CMS_emailsCatalog();
                             $languages = CMS_languagesCatalog::getAllLanguages();
                             $subjects = array();
                             $bodies = array();
                             //editors
                             $editorsIds = $parameters['editors'];
                             $editors = array();
                             foreach ($editorsIds as $editorId) {
                                 $editor = CMS_profile_usersCatalog::getByID($editorId);
                                 if (is_a($editor, 'CMS_profile_user') && !$editor->hasError()) {
                                     $editors[] = $editor;
                                 }
                             }
                             //$editors = $this->getEditors();
                             $editorsInfos = '';
                             foreach ($editors as $editor) {
                                 $editorsInfos .= $editorsInfos ? ",\n" : '';
                                 $editorsInfos .= $editor->getFullName() . ($editor->getEmail() ? ' (' . $editor->getEmail() . ')' : '');
                             }
                             foreach ($languages as $language) {
                                 $subjects[$language->getCode()] = $language->getMessage(self::MESSAGE_POLYMOD_ACTION_EMAIL_SUBJECT, array($objectDef->getLabel($language)), MOD_POLYMOD_CODENAME);
                                 $bodies[$language->getCode()] = $language->getMessage(MESSAGE_EMAIL_VALIDATION_AWAITS) . "\n" . $language->getMessage(self::MESSAGE_POLYMOD_ACTION_EMAIL_BODY, array($objectDef->getLabel($language), $this->getLabel(), $editorsInfos), MOD_POLYMOD_CODENAME);
                             }
                             $group_email->setUserMessages(array($user), $bodies, $subjects, ALERT_LEVEL_VALIDATION, $codename);
                             $group_email->sendMessages();
                             break;
                         case 'delete':
                             $group_email = new CMS_emailsCatalog();
                             $languages = CMS_languagesCatalog::getAllLanguages();
                             $subjects = array();
                             $bodies = array();
                             //editors
                             $editorsIds = $parameters['editors'];
                             $editors = array();
                             foreach ($editorsIds as $editorId) {
                                 $editor = CMS_profile_usersCatalog::getByID($editorId);
                                 if (is_a($editor, 'CMS_profile_user') && !$editor->hasError()) {
                                     $editors[] = $editor;
                                 }
                             }
                             //$editors = $this->getEditors();
                             $editorsInfos = '';
                             foreach ($editors as $editor) {
                                 $editorsInfos .= $editorsInfos ? ",\n" : '';
                                 $editorsInfos .= $editor->getFullName() . ($editor->getEmail() ? ' (' . $editor->getEmail() . ')' : '');
                             }
                             foreach ($languages as $language) {
                                 $subjects[$language->getCode()] = $language->getMessage(self::MESSAGE_POLYMOD_ACTION_EMAIL_DELETE_SUBJECT, array($objectDef->getLabel($language)), MOD_POLYMOD_CODENAME);
                                 $bodies[$language->getCode()] = $language->getMessage(MESSAGE_EMAIL_VALIDATION_AWAITS) . "\n" . $language->getMessage(self::MESSAGE_POLYMOD_ACTION_EMAIL_DELETE_BODY, array($objectDef->getLabel($language), $this->getLabel(), $editorsInfos), MOD_POLYMOD_CODENAME);
                             }
                             $group_email->setUserMessages(array($user), $bodies, $subjects, ALERT_LEVEL_VALIDATION, $codename);
                             $group_email->sendMessages();
                             break;
                         default:
                             $this->raiseError('Unknown script task to do : ' . print_r($parameters, true));
                             return false;
                             break;
                     }
                 }
                 return true;
                 break;
             default:
                 $this->raiseError('Unknown script task to do : ' . print_r($parameters, true));
                 return false;
                 break;
         }
     }
 }
コード例 #9
0
ファイル: email.php プロジェクト: davidmottet/automne
 /**
  * Send the mail
  *
  * @return boolean true on success, false on failure
  * @access public
  */
 function sendEmail()
 {
     if ($this->hasError()) {
         $this->raiseError('Cannot send email, error appened');
         return false;
     }
     $emailSent = true;
     if (!$this->_emailTo) {
         $this->raiseError('emailTo can not be null');
         return false;
     }
     $OB = "----=_OuterBoundary_000";
     $IB = "----=_InnerBoundery_001";
     $encoding = $this->_emailEncoding ? $this->_emailEncoding : APPLICATION_DEFAULT_ENCODING;
     if ($this->_template) {
         //if template is provided for email HTML, use it
         $template = new CMS_file($this->_template);
         $templateContent = $template->getContent();
         $replace = array('{{subject}}' => $this->_subject, '{{body}}' => $this->_emailHTML ? $this->_emailHTML : $this->convertTextToHTML($this->_body), '{{footer}}' => $this->convertTextToHTML($this->_footer), '{{href}}' => CMS_websitesCatalog::getMainURL(), '{{charset}}' => strtoupper($encoding));
         $Html = str_replace(array_keys($replace), $replace, $templateContent);
     } elseif ($this->_emailHTML) {
         //if HTML content is provided for email, use it
         //if this mail contain relative link, append default website address
         if (io::strpos($this->_emailHTML, 'href="/') !== false || io::strpos($this->_emailHTML, 'src="/') !== false) {
             $url = CMS_websitesCatalog::getMainURL();
             $this->_emailHTML = str_replace(array('href="/', 'src="/'), array('href="' . $url . '/', 'src="' . $url . '/'), $this->_emailHTML);
         }
         $Html = $this->_emailHTML;
     } else {
         //else use text content converted to HTML
         $Html = $this->convertTextToHTML($this->_body . ($this->_footer ? "\n\n" . $this->_footer : ''));
     }
     $Text = $this->_body ? $this->_body . ($this->_footer ? "\n\n" . $this->_footer : '') : "Sorry, but you need an HTML compatible mailer to read this mail...";
     $From = $this->_emailFrom ? $this->_emailFrom : APPLICATION_POSTMASTER_EMAIL;
     $FromName = $this->_fromName ? $this->_fromName : '';
     $toUsers = is_array($this->_emailTo) && $this->_emailTo ? $this->_emailTo : array($this->_emailTo);
     $cc = is_array($this->_cc) && $this->_cc ? $this->_cc : ($this->_cc ? array($this->_cc) : '');
     $bcc = is_array($this->_bcc) && $this->_bcc ? $this->_bcc : ($this->_bcc ? array($this->_bcc) : '');
     $toNames = is_array($this->_toName) && $this->_toName ? $this->_toName : array($this->_toName);
     $Error = $this->_error ? $this->_error : '';
     $Subject = $this->_subject;
     $AttmFiles = $this->_files;
     //Messages start with text/html alternatives in OB
     $Msg = "This is a multi-part message in MIME format.\n";
     $Msg .= "\n--" . $OB . "\n";
     $Msg .= "Content-Type: multipart/alternative;\n\tboundary=\"" . $IB . "\"\n\n";
     //plaintext section
     $Msg .= "\n--" . $IB . "\n";
     $Msg .= "Content-Type: text/plain;\n\tcharset=\"" . $encoding . "\"\n";
     $Msg .= "Content-Transfer-Encoding: 8bit\n\n";
     // plaintext goes here
     $Msg .= $Text . "\n\n";
     // html section
     $Msg .= "\n--" . $IB . "\n";
     $Msg .= "Content-Type: text/html;\n\tcharset=\"" . $encoding . "\"\n";
     $Msg .= "Content-Transfer-Encoding: base64\n\n";
     // html goes here
     $Msg .= chunk_split(base64_encode($Html), 76, "\n") . "\n\n";
     // end of IB
     $Msg .= "\n--" . $IB . "--\n";
     // attachments
     if (is_array($AttmFiles) && $AttmFiles) {
         foreach ($AttmFiles as $AttmFile) {
             $patharray = explode("/", $AttmFile);
             $FileName = $patharray[count($patharray) - 1];
             $Msg .= "\n--" . $OB . "\n";
             $Msg .= "Content-Type: application/octet-stream;\n\tname=\"" . $FileName . "\"\n";
             $Msg .= "Content-Transfer-Encoding: base64\n";
             $Msg .= "Content-Disposition: attachment;\n\tfilename=\"" . $FileName . "\"\n\n";
             //file goes here
             $fd = fopen($AttmFile, "r");
             $FileContent = fread($fd, filesize($AttmFile));
             fclose($fd);
             $FileContent = chunk_split(base64_encode($FileContent), 76, "\n");
             $Msg .= $FileContent;
             $Msg .= "\n\n";
         }
     }
     if (LOG_SENDING_MAIL) {
         global $cms_user;
         $user = $cms_user ? $cms_user : CMS_profile_usersCatalog::getById(ROOT_PROFILEUSER_ID);
     }
     //message ends
     $Msg .= "\n--" . $OB . "--\n";
     foreach ($toUsers as $key => $to) {
         if (sensitiveIO::isValidEmail($to)) {
             $headers = "MIME-Version: 1.0\n";
             if ($FromName) {
                 $headers .= "From: " . $this->EncodeHeader($FromName) . " <" . $From . ">\n";
                 $headers .= "Reply-To: " . $this->EncodeHeader($FromName) . " <" . $From . ">\n";
                 $headers .= "Return-Path: " . $this->EncodeHeader($FromName) . " <" . $From . ">\n";
                 $headers .= "X-Sender: " . $this->EncodeHeader($FromName) . " <" . $From . ">\n";
             } else {
                 $headers .= "From: " . $From . "\n";
                 $headers .= "Reply-To: " . $From . "\n";
                 $headers .= "Return-Path: " . $From . "\n";
                 $headers .= "X-Sender: " . $From . "\n";
             }
             if (isset($toNames[$key]) && $toNames[$key]) {
                 $to = $this->EncodeHeader($toNames[$key]) . " <" . $to . ">";
             }
             if ($Error) {
                 $headers .= "Errors-To: " . $Error . "\n";
             }
             if ($cc) {
                 $headers .= "Cc: " . implode(',', $cc) . "\n";
             }
             if ($bcc) {
                 $headers .= "Bcc: " . implode(',', $bcc) . "\n";
             }
             /*$headers.="User-Agent: Automne (TM)\n";*/
             //Cause email to be reported as spam
             $headers .= "X-Mailer: Automne (TM)\n";
             $headers .= "X-Priority: 3\n";
             $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"" . $OB . "\"\n";
             //Check drop emails list (Automne default emails)
             if (!in_array($to, $this->_drop) && !in_array($From, $this->_drop)) {
                 //log in the cms_error_log the complete email
                 if (LOG_APPLICATION_MAIL) {
                     $this->log($to . "\n" . $this->EncodeHeader($Subject) . "\n\n" . $Msg);
                 }
                 //if mail deactivated always return true
                 if (NO_APPLICATION_MAIL) {
                     return $emailSent;
                 } else {
                     //send emails
                     $sent = @mail($to, $this->EncodeHeader($Subject), $Msg, $headers);
                 }
                 $emailSent = $emailSent && $sent;
                 if (LOG_SENDING_MAIL) {
                     $log = new CMS_log();
                     $log->logMiscAction(CMS_log::LOG_ACTION_SEND_EMAIL, $user, 'Email To ' . $to . ', From : ' . $From . ', Subject : ' . $Subject . ', Sent : ' . ($sent ? 'Yes' : 'Error'));
                 }
             } else {
                 if (LOG_SENDING_MAIL) {
                     $log = new CMS_log();
                     $log->logMiscAction(CMS_log::LOG_ACTION_SEND_EMAIL, $user, 'Email To ' . $to . ', From : ' . $From . ', Subject : ' . $Subject . ', Sent : No, Dropped because sender or receiver address is under Automne drop address list');
                 } else {
                     $this->raiseError('Email to ' . $to . ', from : ' . $From . ' (subject : ' . $Subject . '), Dropped because sender or receiver address is under Automne drop address list');
                 }
             }
         } else {
             if (LOG_SENDING_MAIL) {
                 $log = new CMS_log();
                 $log->logMiscAction(CMS_log::LOG_ACTION_SEND_EMAIL, $user, 'Email To ' . $to . ', From : ' . $From . ', Subject : ' . $Subject . ', Sent : No, Dropped because receiver address is not valid');
             } else {
                 $this->raiseError('Email to ' . $to . ', from : ' . $From . ' (subject : ' . $Subject . '), Dropped because receiver address is not valid');
             }
         }
     }
     if (!$emailSent) {
         $this->raiseError('Email was not sent, please check your sendmail configuration or SMTP connection in php.ini');
     }
     return $emailSent;
 }
コード例 #10
0
    $view->show();
}
//do action on resource
//check for lock
if ($action != 'unlock' && $resource->getLock() && $resource->getLock() != $cms_user->getUserId()) {
    CMS_grandFather::raiseError('Object ' . $resourceId . ' of module ' . $codename . ' is currently locked by another user and can\'t be updated.');
    $lockuser = CMS_profile_usersCatalog::getByID($resource->getLock());
    $view->setActionMessage($cms_language->getmessage(MESSAGE_ERROR_ELEMENT_LOCKED, array($lockuser->getFullName())));
    $view->show();
}
$initialStatus = $resource->getStatus()->getHTML(false, $cms_user, $codename, $resource->getID());
switch ($action) {
    case 'unlock':
        if ($resource->getLock() && $resource->getLock() != $cms_user->getUserId() && !$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
            CMS_grandFather::raiseError('Object ' . $resourceId . ' of module ' . $codename . ' is currently locked by another user and can\'t be unlocked.');
            $lockuser = CMS_profile_usersCatalog::getByID($resource->getLock());
            $view->setActionMessage($cms_language->getmessage(MESSAGE_ERROR_ELEMENT_REALY_LOCKED, array($lockuser->getFullName())));
            $view->show();
        }
        if ($resource->getLock()) {
            $resource->unlock();
        }
        break;
    default:
        CMS_grandFather::raiseError('Unknown action ' . $action . ' to do for resource ' . $resourceId . ' with value : ' . $value);
        $view->show();
        break;
}
//set user message if any
if ($cms_message) {
    $view->setActionMessage($cms_message);
コード例 #11
0
ファイル: profileuser.php プロジェクト: davidmottet/automne
 /**
  * Set Login
  *
  * @param string $login
  * @return void
  * @access public
  */
 public function setLogin($login)
 {
     if (!CMS_profile_user::checkLogin($login)) {
         $this->raiseError('Login is invalid. A login may not start or end by a space nor contain a non-printable character');
         return false;
     }
     // Check if login allready exists
     if (CMS_profile_usersCatalog::loginExists($login, $this)) {
         $this->raiseError('Login allready exists. Choose another one');
         return false;
     }
     $this->_login = $login;
     return true;
 }
コード例 #12
0
ファイル: users-datas.php プロジェクト: davidmottet/automne
    //search users
    $users = CMS_profile_usersCatalog::search($search, $letter, $groupId, $sort, $dir, $start, $limit);
} else {
    //search users
    $users = CMS_profile_usersCatalog::search($search, $letter, false, $sort, $dir, $start, $limit);
}
//loop over users to get all required infos
foreach ($users as $user) {
    $datas = array('id' => $user->getUserId(), 'firstName' => $user->getFirstName(), 'lastName' => $user->getLastName(), 'login' => $user->getLogin(), 'email' => $user->getEmail(), 'active' => $user->isActive());
    if ($groupId) {
        $datas['belong'] = isset($groupUsers[$user->getUserId()]);
    }
    if ($withGroups) {
        //groups of user
        $userGroups = array();
        $groups = CMS_profile_usersGroupsCatalog::getGroupsOfUser($user);
        foreach ($groups as $group) {
            $userGroups[] = array('id' => $group->getGroupId(), 'label' => $group->getLabel(), 'description' => $group->getDescription());
        }
        $datas['groups'] = $userGroups;
    }
    $usersDatas['users'][] = $datas;
}
//total users count for search
if ($groupId && $filter) {
    $usersDatas['totalCount'] = sizeof(CMS_profile_usersCatalog::search($search, $letter, $groupId, $sort, $dir, 0, 0, false, false));
} else {
    $usersDatas['totalCount'] = sizeof(CMS_profile_usersCatalog::search($search, $letter, false, $sort, $dir, 0, 0, false, false));
}
$view->setContent($usersDatas);
$view->show();
コード例 #13
0
ファイル: users.php プロジェクト: davidmottet/automne
//get records / pages
$recordsPerPage = CMS_session::getRecordsPerPage();
//special users Id
$rootProfileUserId = ROOT_PROFILEUSER_ID;
$anonymousProfileUserId = ANONYMOUS_PROFILEUSER_ID;
//user groups
$userGroups = array();
$userGroups['groups'] = array(array('id' => 0, 'label' => '-', 'description' => '{$cms_language->getJsMessage(MESSAGE_PAGE_NO_GROUP)}'));
$groups = CMS_profile_usersGroupsCatalog::getAll();
foreach ($groups as $group) {
    $userGroups['groups'][] = array('id' => $group->getGroupId(), 'label' => $group->getLabel(), 'description' => $group->getDescription());
}
//json encode groups datas
$userGroups = sensitiveIO::jsonEncode($userGroups);
//users letters
$letters = CMS_profile_usersCatalog::getLettersForLastName();
//$letters = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
$lettersButtons = '';
foreach ($letters as $letter) {
    $lettersButtons .= '{
		text:			\'' . io::strtoupper($letter) . '\',
		enableToggle:	true,
		handler:		clickLetter
	},';
}
//remove last comma
$lettersButtons = io::substr($lettersButtons, 0, -1);
$jscontent = <<<END
\tvar usersWindow = Ext.getCmp('{$winId}');
\tvar fatherWindow = Ext.getCmp('{$fatherId}');
\t
コード例 #14
0
 /**
  * Returns the label for current status.
  *
  * @param CMS_language $language : Current language to get label
  * @return string label
  * @access public
  */
 function getStatusLabel($language)
 {
     //Hack : check for non-sense status (usually it is a page which creation is not properly done)
     if ($this->_publication == RESOURCE_PUBLICATION_NEVERVALIDATED && !$this->_editions) {
         $this->addEdition(RESOURCE_EDITION_CONTENT, $user);
         $this->writeToPersistence();
     }
     $img_status = $this->_publication == RESOURCE_PUBLICATION_NEVERVALIDATED ? "rond" : "carre";
     if ($this->_publication == RESOURCE_PUBLICATION_PUBLIC) {
         $img_status .= "_pub";
     }
     if ($this->_proposedFor == RESOURCE_LOCATION_DELETED) {
         $img_status .= "_sup";
     }
     if ($this->_proposedFor == RESOURCE_LOCATION_ARCHIVED) {
         $img_status .= "_arc";
     }
     if (($this->_editions & RESOURCE_EDITION_BASEDATA || $this->_editions & RESOURCE_EDITION_CONTENT) && !($this->_validationsRefused & RESOURCE_EDITION_BASEDATA) && !($this->_validationsRefused & RESOURCE_EDITION_CONTENT)) {
         $img_status .= "-o";
     } elseif ($this->_validationsRefused & RESOURCE_EDITION_BASEDATA || $this->_validationsRefused & RESOURCE_EDITION_CONTENT || $this->_validationsRefused & RESOURCE_EDITION_LOCATION) {
         $img_status .= "-r";
     } else {
         $img_status .= "-v";
     }
     if ($this->_editions & RESOURCE_EDITION_SIBLINGSORDER) {
         if ($this->_validationsRefused & RESOURCE_EDITION_SIBLINGSORDER) {
             $img_siblings = "orderefuse";
         } else {
             $img_siblings = "ordervalider";
         }
     }
     if ($this->_editions & RESOURCE_EDITION_MOVE) {
         if ($this->_validationsRefused & RESOURCE_EDITION_MOVE) {
             $img_siblings = "mouvrefuse";
         } else {
             $img_siblings = "mouvalider";
         }
     }
     if ($this->getDraft() && $img_status == 'rond-o') {
         $img_status = 'draft';
     }
     $label = $this->_getStatusLabel($img_status);
     $label .= isset($img_siblings) ? ', ' . $this->_getStatusLabel($img_siblings) : '';
     if ($lockUserId = $this->getLock()) {
         $lockUser = CMS_profile_usersCatalog::getById($lockUserId);
         $lockDate = $this->getLockDate();
         if (is_object($lockUser) && is_object($lockDate)) {
             $label .= ' - ' . $language->getMessage(self::MESSAGE_STATUS_LOCKEDBY) . ' ' . $lockUser->getFullName() . ' (' . $lockDate->getLocalizedDate($language->getDateFormat() . ' - H:i:s') . ')';
         } else {
             $label .= ' - ' . $language->getMessage(self::MESSAGE_STATUS_LOCKED);
         }
     }
     if ($this->getDraft()) {
         $label .= $img_status != 'draft' ? ' - ' . $language->getMessage(self::MESSAGE_STATUS_DRAFT) : $language->getMessage(self::MESSAGE_STATUS_DRAFT);
     }
     /*if ($this->getDraft() && $img_status == 'rond-o') {
     			$label .= $language->getMessage(self::MESSAGE_STATUS_DRAFT);
     		}*/
     return $label;
 }
コード例 #15
0
         foreach ($elements as $element) {
             $usr = CMS_profile_usersCatalog::getByID($element[0]);
             if (is_a($usr, 'CMS_profile_user') && !$usr->hasError()) {
                 $users[] = $usr;
             }
         }
         foreach ($languages as $language) {
             $subjects[$language->getCode()] = $language->getMessage(MESSAGE_PAGE_ACTION_EMAIL_REFUSE_SUBJECT);
             $bodies[$language->getCode()] = $language->getMessage(MESSAGE_PAGE_ACTION_EMAIL_REFUSE_BODY, $args);
         }
         break;
     case VALIDATION_OPTION_TRANSFER:
         if ($transferUser) {
             //send an email to the transferred validator
             $args = array($cms_user->getFullName(), $validation->getValidationLabel() . " (ID : " . $validation->getResourceID() . ")", $mod->getLabel($cms_language), SensitiveIO::sanitizeHTMLString($comment));
             $users = array(CMS_profile_usersCatalog::getByID($transferUser));
             foreach ($languages as $language) {
                 $subjects[$language->getCode()] = $language->getMessage(MESSAGE_PAGE_ACTION_EMAIL_TRANSFER_SUBJECT);
                 $bodies[$language->getCode()] = $language->getMessage(MESSAGE_PAGE_ACTION_EMAIL_TRANSFER_BODY, $args);
             }
         }
         break;
 }
 $group_email = new CMS_emailsCatalog();
 $group_email->setUserMessages($users, $bodies, $subjects, ALERT_LEVEL_VALIDATION, $validation->getModuleCodename());
 $group_email->sendMessages();
 //check if resource still exists
 $resUpdated = $validation->getResource();
 $deleted = true;
 if ($resUpdated && is_object($resUpdated)) {
     $res = $resUpdated;
コード例 #16
0
 /**
  * Returns all the validators.
  * Static function.
  *
  * @param string $moduleCodename The codename of the module to validate
  * @return array(CMS_profile_user)
  * @access public
  */
 static function getValidators($moduleCodename)
 {
     $sql = "\n\t\t\tselect\n\t\t\t\tuserId_puv\n\t\t\tfrom\n\t\t\t\tprofilesUsers_validators,\n\t\t\t\tprofilesUsers\n\t\t\twhere\n\t\t\t\tmodule_puv='" . SensitiveIO::sanitizeSQLString($moduleCodename) . "'\n\t\t\t\tand userId_puv = id_pru\n\t\t\t\tand active_pru = 1\n\t\t\t\tand deleted_pru = 0\n\t\t";
     $q = new CMS_query($sql);
     $users = array();
     $users_ids = array();
     while ($id = $q->getValue("userId_puv")) {
         $usr = CMS_profile_usersCatalog::getByID($id);
         if (!$usr->hasError()) {
             $users[$usr->getLastName() . '-' . $id] = $usr;
             $users_ids[] = $id;
         }
     }
     //add the users with 'edit & validate all' right
     $sql = "\n\t\t\tselect\n\t\t\t\tid_pru\n\t\t\tfrom\n\t\t\t\tprofilesUsers,\n\t\t\t\tprofiles\n\t\t\twhere\n\t\t\t\tprofile_pru = id_pr\n\t\t\t\tand administrationClearance_pr & " . CLEARANCE_ADMINISTRATION_EDITVALIDATEALL . "\n\t\t\t\tand active_pru = 1\n\t\t\t\tand deleted_pru = 0\n\t\t";
     $q = new CMS_query($sql);
     while ($id = $q->getValue("id_pru")) {
         if (!in_array($id, $users_ids)) {
             $usr = CMS_profile_usersCatalog::getByID($id);
             if (!$usr->hasError()) {
                 $users[$usr->getLastName() . '-' . $id] = $usr;
             }
         }
     }
     //sort users by last name
     uksort($users, array('io', 'natcasecmp'));
     return $users;
 }
コード例 #17
0
         }
     }
     if (is_a($group, "CMS_profile_usersGroup") && is_a($user, "CMS_profile_user")) {
         //add group
         $user->addGroup($groupId);
         //then write user profile into persistence
         $user->writeToPersistence();
         $log = new CMS_log();
         $log->logMiscAction(CMS_log::LOG_ACTION_PROFILE_USER_EDIT, $cms_user, "User : "******" (add group to user)");
     } else {
         $cms_message = $cms_language->getMessage(MESSAGE_PAGE_USER_OR_GROUP_UNKNOWN);
     }
     break;
 case 'deluser':
     if ($userId) {
         $user = CMS_profile_usersCatalog::getByID($userId);
         if (!$user || $user->hasError()) {
             $user = false;
         }
     }
     if (is_a($group, "CMS_profile_usersGroup") && is_a($user, "CMS_profile_user")) {
         //Get current user groups ids
         $userGroupIds = CMS_profile_usersGroupsCatalog::getGroupsOfUser($user, true, true);
         //first reset profile clearances
         $user->resetClearances();
         //then loop through user groups
         foreach ($userGroupIds as $userGroupId) {
             if ($userGroupId == $groupId) {
                 //remove user to group
                 $oldGroup = CMS_profile_usersGroupsCatalog::getByID($groupId);
                 if ($oldGroup->removeUser($user)) {
コード例 #18
0
ファイル: logcatalog.php プロジェクト: davidmottet/automne
 /**
  * Get by resource
  *
  * @param CMS_
  * @return array(CMS_log)
  * @access public
  */
 static function getByResourceAction($moduleCodename, $resourceId, $action, $limit = false)
 {
     $sql = "\n\t\t\tselect\n\t\t\t\t*\n\t\t\tfrom\n\t\t\t\tlog\n\t\t\twhere\n\t\t\t\tmodule_log='" . sensitiveIO::sanitizeSQLString($moduleCodename) . "'\n\t\t\t\tand resource_log='" . sensitiveIO::sanitizeSQLString($resourceId) . "'";
     if (is_array($action)) {
         $sql .= " and action_log in (" . sensitiveIO::sanitizeSQLString(implode(',', $action)) . ")";
     } else {
         $sql .= " and action_log='" . sensitiveIO::sanitizeSQLString($action) . "'";
     }
     $sql .= "\n\t\t\torder by\n\t\t\t\tdatetime_log desc\n\t\t";
     if ($limit && sensitiveIO::isPositiveInteger($limit)) {
         $sql .= " limit 0, " . $limit;
     }
     $logs = array();
     $q = new CMS_query($sql);
     if ($q->getNumRows()) {
         $users = array();
         while ($r = $q->getArray()) {
             if (!isset($users[$r["user_log"]])) {
                 $users[$r["user_log"]] = CMS_profile_usersCatalog::getByID($r["user_log"]);
             }
             $lg = new CMS_log($r, $users[$r["user_log"]]);
             if (!$lg->hasError()) {
                 $logs[] = $lg;
             }
         }
     }
     return $logs;
 }
コード例 #19
0
     $image = $template->getImage();
 } else {
     $image = 'nopicto.gif';
 }
 $template->setImage($image);
 //groups
 $template->delAllGroups();
 foreach ($groups as $group) {
     $template->addGroup($group);
 }
 if ($newgroups) {
     foreach ($newgroups as $group) {
         $template->addGroup($group);
     }
     if ($nouserrights) {
         CMS_profile_usersCatalog::denyTemplateGroupsToUsers($newgroups);
     }
 }
 //websites denied
 $websites = CMS_websitesCatalog::getAll();
 $deniedWebsites = array();
 foreach ($websites as $id => $website) {
     if (!in_array($id, $selectedWebsites)) {
         $deniedWebsites[] = $id;
     }
 }
 $template->delAllWebsiteDenied();
 foreach ($deniedWebsites as $deniedWebsite) {
     $template->denyWebsite($deniedWebsite);
 }
 //XML definition file
コード例 #20
0
 /**
  * Remove User
  *
  * @var integer or CMS_profile_user
  * @access public
  */
 function removeUser(&$user)
 {
     if (is_a($user, "CMS_profile_user")) {
         if (SensitiveIO::isInSet($user->getUserId(), $this->_users)) {
             $users = array();
             foreach ($this->_users as $userId) {
                 if ($userId != $user->getUserId()) {
                     $users[] = $userId;
                 }
             }
             $this->_users = $users;
             //then remove categories clearance to user because they are only associated to group
             $user->deleteCategoriesClearances();
         }
     } elseif (SensitiveIO::isPositiveInteger($user)) {
         if (SensitiveIO::isInSet($user, $this->_users)) {
             $users = array();
             foreach ($this->_users as $userId) {
                 if ($userId != $user) {
                     $users[] = $userId;
                 }
             }
             $this->_users = $users;
             //then remove categories clearance to user because they are only associated to group
             $user = CMS_profile_usersCatalog::getByID($user);
             if (is_a($user, "CMS_profile_user")) {
                 $user->deleteCategoriesClearances();
             }
         }
     } else {
         $this->raiseError('Incorrect user type');
         return false;
     }
     //Clear polymod cache
     //CMS_cache::clearTypeCacheByMetas('polymod', array('resource' => 'users'));
     CMS_cache::clearTypeCache('polymod');
     return true;
 }
コード例 #21
0
 /**
  * get HTML admin subfields parameters (used to enter object categories parameters values in admin)
  *
  * @return string : the html admin
  * @access public
  */
 function getHTMLSubFieldsParametersDisableUsers($language, $prefixName)
 {
     $params = $this->getParamsValues();
     $values = $this->_parameterValues;
     $input = '';
     $parameters = $this->getSubFieldParameters();
     foreach ($parameters as $parameterID => $parameter) {
         $paramValue = $values[$parameterID];
         if ($parameter["type"] == "disableUsers") {
             // Search all users/groups
             $usersGroups = CMS_profile_usersCatalog::getUsersLabels(true, true);
             //sort and index table
             $userGroupSorted = array();
             foreach ($usersGroups as $userId => $aUserLabel) {
                 $userGroupSorted[$userId] = $aUserLabel;
             }
             //sort objects by name case insensitive
             natcasesort($userGroupSorted);
             // Search all selected users/groups
             $associated_items = array();
             if ($params[$parameter["internalName"]]) {
                 $associated_items = explode(";", $params[$parameter["internalName"]]);
             }
             //remove deleted users from selected list
             foreach ($associated_items as $key => $userId) {
                 if (!isset($userGroupSorted[$userId])) {
                     unset($associated_items[$key]);
                 }
             }
             // Create usersListboxes
             $s_items_listboxes = CMS_dialog_listboxes::getListBoxes(array('field_name' => $prefixName . $parameter['internalName'], 'items_possible' => $userGroupSorted, 'items_selected' => $associated_items, 'select_width' => '250px', 'select_height' => '200px', 'form_name' => 'frm', 'leftTitle' => $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_PARAMETER_USERS_LEFT_TITLE, false, MOD_POLYMOD_CODENAME), 'rightTitle' => $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_PARAMETER_USERS_RIGHT_TITLE, false, MOD_POLYMOD_CODENAME)));
             $input .= $s_items_listboxes;
         }
     }
     return $input;
 }
コード例 #22
0
     $image = pathinfo($movedImage, PATHINFO_BASENAME);
 } elseif ($image) {
     $image = pathinfo($image, PATHINFO_BASENAME);
 }
 $row->setImage($image);
 //groups
 $row->delAllGroups();
 foreach ($groups as $group) {
     $row->addGroup($group);
 }
 if ($newgroups) {
     foreach ($newgroups as $group) {
         $row->addGroup($group);
     }
     if ($nouserrights) {
         CMS_profile_usersCatalog::denyRowGroupsToUsers($newgroups);
     }
 }
 //selected templates
 $row->setFilteredTemplates($selectedTemplates);
 if (!$cms_message && !$row->hasError()) {
     if ($row->writeToPersistence()) {
         $log = new CMS_log();
         if (!$creation) {
             $log->logMiscAction(CMS_log::LOG_ACTION_TEMPLATE_EDIT_ROW, $cms_user, "Row : " . $row->getLabel() . " (edit base data)");
             $content = array('success' => true);
             $cms_message = $cms_language->getMessage(MESSAGE_ACTION_ROW_SAVED);
         } else {
             $log->logMiscAction(CMS_log::LOG_ACTION_TEMPLATE_EDIT_ROW, $cms_user, "Row  : " . $row->getLabel() . " (create row)");
             $content = array('success' => array('rowId' => $row->getID()));
             $cms_message = $cms_language->getMessage(MESSAGE_ACTION_ROW_CREATED);
コード例 #23
0
ファイル: search-datas.php プロジェクト: davidmottet/automne
 $items = array();
 switch ($type) {
     case 'rows':
         $rows = CMS_rowsCatalog::getAll(true, '', array(), array_keys($results));
         foreach ($rows as $row) {
             $items[] = $row->getJSonDescription($cms_user, $cms_language, false);
         }
         break;
     case 'templates':
         $tpls = CMS_pageTemplatesCatalog::getAll(true, '', array(), '', array_keys($results));
         foreach ($tpls as $tpl) {
             $items[] = $tpl->getJSonDescription($cms_user, $cms_language, false);
         }
         break;
     case 'users':
         $users = CMS_profile_usersCatalog::getAll(false, false, true, array('id_pru' => array_keys($results)));
         foreach ($users as $user) {
             $items[] = $user->getJSonDescription($cms_user, $cms_language, false);
         }
         break;
     case 'groups':
         $groups = CMS_profile_usersGroupsCatalog::search('', '', false, array_keys($results));
         foreach ($groups as $group) {
             $items[] = $group->getJSonDescription($cms_user, $cms_language, false);
         }
         break;
     default:
         $module = CMS_modulesCatalog::getByCodename($type);
         $items = $module->getSearchResults(array_keys($results), $cms_user);
         break;
 }
コード例 #24
0
                         case 'delete':
                             foreach ($languages as $language) {
                                 $subjects[$language->getCode()] = $language->getMessage(MESSAGE_PAGE_ACTION_EMAIL_DELETE_SUBJECT);
                                 $bodies[$language->getCode()] = $language->getMessage(MESSAGE_EMAIL_VALIDATION_AWAITS) . "\n" . $language->getMessage(MESSAGE_PAGE_ACTION_EMAIL_DELETE_BODY, array($cms_page->getTitle() . ' (ID : ' . $cms_page->getID() . ')', $cms_user->getFullName()));
                             }
                             break;
                         case 'archive':
                             foreach ($languages as $language) {
                                 $subjects[$language->getCode()] = $language->getMessage(MESSAGE_PAGE_ACTION_EMAIL_ARCHIVE_SUBJECT);
                                 $bodies[$language->getCode()] = $language->getMessage(MESSAGE_EMAIL_VALIDATION_AWAITS) . "\n" . $language->getMessage(MESSAGE_PAGE_ACTION_EMAIL_ARCHIVE_BODY, array($cms_page->getTitle() . ' (ID : ' . $cms_page->getID() . ')', $cms_user->getFullName()));
                             }
                             break;
                     }
                     break;
             }
             $potentialValidators = CMS_profile_usersCatalog::getValidators(MOD_STANDARD_CODENAME);
             $validators = array();
             foreach ($potentialValidators as $aPotentialValidator) {
                 if ($aPotentialValidator->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_EDIT)) {
                     $validators[] = $aPotentialValidator;
                 }
             }
             $group_email->setUserMessages($validators, $bodies, $subjects, ALERT_LEVEL_VALIDATION, MOD_STANDARD_CODENAME);
             $group_email->sendMessages();
         } else {
             $validation = new CMS_resourceValidation(MOD_STANDARD_CODENAME, $edited, $cms_page);
             $mod = CMS_modulesCatalog::getByCodename(MOD_STANDARD_CODENAME);
             $mod->processValidation($validation, VALIDATION_OPTION_ACCEPT);
         }
     }
 }
コード例 #25
0
ファイル: page.php プロジェクト: davidmottet/automne
 /**
  * Gets the page reminded editors for an edition
  *
  * @param integer $edition The edition the user should have made to be returned
  * @return array(CMS_profile_user) The editors
  * @access public
  */
 function getRemindedEditors($edition)
 {
     $elements = $this->_remindedEditors->getElementsWithOneValue($edition, 2);
     $editors = array();
     foreach ($elements as $element) {
         $user = CMS_profile_usersCatalog::getByID($element[0]);
         if ($user) {
             $editors[] = $user;
         }
     }
     return $editors;
 }
コード例 #26
0
ファイル: session.php プロジェクト: davidmottet/automne
 /**
  * Get user object
  *
  * @return user object
  * @access public
  */
 public static function getUser()
 {
     if (!io::isPositiveInteger(self::$_userID)) {
         return false;
     }
     return CMS_profile_usersCatalog::getByID(self::$_userID);
 }
コード例 #27
0
ファイル: fckconfig.php プロジェクト: davidmottet/automne
 *
 * == END LICENSE ==
 *
 * Editor configuration settings.
 *
 * Follow this link for more information:
 * http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options
 */
// $Id: fckconfig.php,v 1.7 2010/03/08 16:44:28 sebastien Exp $
//for this page, HTML output compression is not welcome.
define("ENABLE_HTML_COMPRESSION", false);
//load requirements (FE only because it can be used in FE and BO)
require_once dirname(__FILE__) . '/../../cms_rc_frontend.php';
if (!is_object($cms_user)) {
    //initialize public user
    $cms_user = CMS_profile_usersCatalog::getByID(ANONYMOUS_PROFILEUSER_ID);
}
// Prevent the browser from caching the result.
// Date in the past
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// always modified
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// HTTP/1.1
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
// HTTP/1.0
header('Pragma: no-cache');
//send document UTF-8 BOM (do not remove)
header('Content-type: text/javascript; charset=UTF-8');
echo '' . "\n";
//include modules codes in output file
コード例 #28
0
ファイル: auth.php プロジェクト: davidmottet/automne
 /**
  * Test user auto login from cookie values
  * 
  * @return boolean true if autologin accepted, false otherwise
  * @access private
  */
 function _autoLogin()
 {
     $attrs = @explode("|", base64_decode($_COOKIE[CMS_session::getAutoLoginCookieName()]));
     $id_ses = (int) $attrs[0];
     $session_id = $attrs[1];
     if ($id_ses > 0 && $session_id) {
         $sql = "\n\t\t\t\tselect\n\t\t\t\t\t*\n\t\t\t\tfrom\n\t\t\t\t\tsessions\n\t\t\t\twhere\n\t\t\t\t\tid_ses = '" . SensitiveIO::sanitizeSQLString($id_ses) . "'\n\t\t\t\t\tand phpid_ses = '" . SensitiveIO::sanitizeSQLString($session_id) . "'\n\t\t\t\t\tand cookie_expire_ses != '0000-00-00 00:00:00'\n\t\t\t";
         if (CHECK_REMOTE_IP_MASK && isset($_SERVER['REMOTE_ADDR'])) {
             //Check for a range in IPv4 or for the exact address in IPv6
             if (filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                 $a_ip_seq = explode(".", $_SERVER['REMOTE_ADDR']);
                 $sql .= "and remote_addr_ses like '" . SensitiveIO::sanitizeSQLString($a_ip_seq[0] . "." . $a_ip_seq[1] . ".") . "%'\n\t\t\t\t\t";
             } else {
                 $sql .= "and remote_addr_ses = '" . SensitiveIO::sanitizeSQLString($_SERVER['REMOTE_ADDR']) . "'\n\t\t\t\t\t";
             }
         }
         $q = new CMS_query($sql);
         if ($q->getNumRows() == 1) {
             $this->_user = CMS_profile_usersCatalog::getByID($q->getValue('user_ses'));
             if ($this->_user && !$this->_user->hasError() && !$this->_user->isDeleted() && $this->_user->isActive()) {
                 $this->_messages[] = self::AUTH_AUTOLOGIN_VALID;
                 $this->_result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_user->getUserId(), $this->_messages);
                 return true;
             } else {
                 $this->_messages[] = self::AUTH_AUTOLOGIN_INVALID_USER;
                 $this->_result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE, null, $this->_messages);
             }
         }
     }
     return false;
 }
コード例 #29
0
//try to instanciate the requested page
$cms_page = CMS_tree::getPageByID($currentPage);
//instanciate page and check if user has view rights on it
if (isset($cms_page) && $cms_page->hasError()) {
    CMS_grandFather::raiseError('Error on page : ' . $cms_page->getID());
    $view->show();
}
//check for edit rights for user
if (!$cms_user->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_EDIT)) {
    CMS_grandFather::raiseError('Error, user has no rights on page : ' . $cms_page->getID());
    $view->show();
}
//check for lock
if ($cms_page->getLock() && $cms_page->getLock() != $cms_user->getUserId()) {
    CMS_grandFather::raiseError('Page ' . $currentPage . ' is currently locked by another user and can\'t be updated.');
    $lockuser = CMS_profile_usersCatalog::getByID($cms_page->getLock());
    $view->setActionMessage($cms_language->getMessage(MESSAGE_PAGE_ERROR_LOCKED, array($lockuser->getFullName())));
    $view->show();
}
$initialStatus = $cms_page->getStatus()->getHTML(false, $cms_user, MOD_STANDARD_CODENAME, $cms_page->getID());
//page edited status
$edited = false;
switch ($action) {
    case 'add-row':
        //instanciate the clientspace
        $clientSpace = CMS_moduleClientSpace_standard_catalog::getByTemplateAndTagID($tpl, $cs, $visualMode == PAGE_VISUALMODE_FORM);
        //generate row unique ID
        $uniqueId = md5(uniqid());
        //add row to CS
        $row = $clientSpace->addRow($rowId, $uniqueId, $index);
        if ($row) {
コード例 #30
0
ファイル: logs.php プロジェクト: davidmottet/automne
$view = CMS_view::getInstance();
//set default display mode for this page
$view->setDisplayMode(CMS_view::SHOW_RAW);
//This file is an admin file. Interface must be secure
$view->setSecure();
//check user rights
if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_VIEWLOG)) {
    CMS_grandFather::raiseError('User has no logs management rights ...');
    $view->show();
}
//get records / pages
$recordsPerPage = CMS_session::getRecordsPerPage();
//users
$users = array();
$users['users'] = array(array('id' => 0, 'name' => '-'));
$allUsers = CMS_profile_usersCatalog::getUsersLabels();
foreach ($allUsers as $id => $fullname) {
    $users['users'][] = array('id' => $id, 'name' => $fullname);
}
//json encode groups datas
$users = sensitiveIO::jsonEncode($users);
//modules
$modules = array();
$allModules = CMS_modulesCatalog::getAll();
$modules['modules'] = array(array('codename' => '', 'label' => '-'));
$modules['modules'][] = array('codename' => MOD_STANDARD_CODENAME, 'label' => $cms_language->getMessage(MESSAGE_PAGE_STANDARD_MODULE_LABEL));
foreach ($allModules as $module) {
    if ($module->getCodename() != MOD_STANDARD_CODENAME) {
        $modules['modules'][] = array('codename' => $module->getCodename(), 'label' => $module->getLabel($cms_language));
    }
}