Esempio n. 1
0
 function _getTextFormatingInformationAsHTML($form_element)
 {
     $show_text = true;
     $toggle_id = rand(0, 1000000);
     if (isset($form_element['help_text'])) {
         $show_text = $form_element['help_text'];
     }
     global $c_html_textarea;
     $html = '';
     $item = $this->_environment->getCurrentContextItem();
     $with_htmltextarea = $item->withHtmlTextArea();
     include_once 'functions/misc_functions.php';
     if (plugin_hook_method_active('getTextAreaAsHTML')) {
         $with_htmltextarea = true;
     }
     $text = '';
     if (!isset($c_html_textarea) or !$c_html_textarea or !$form_element['with_html_area'] or !$with_htmltextarea) {
         $title = ' ' . $this->_translator->getMessage('COMMON_TEXT_FORMATING_HELP_FULL');
         $html .= '<div style="padding-top:5px;">';
         $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('HELP_COMMON_FORMAT_TITLE') . ':</div>';
         $text .= $this->_translator->getMessage('COMMON_TEXT_FORMATING_FORMAT_TEXT');
         $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA') . ':</div>';
         $text .= $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT');
         // plugins
         $plugin_text = plugin_hook_output_all('getTextFormatingInformationAsHTML', '', BRLF);
         if (!empty($plugin_text)) {
             $text .= $plugin_text;
         }
         //$html .='<img id="toggle'.$item->getItemID().'" src="images/more.gif"/>';
         $html .= '<img id="toggle' . $toggle_id . '" src="images/more.gif"/>';
         $html .= $title;
         //$html .= '<div id="creator_information'.$item->getItemID().'">'.LF;
         $html .= '<div id="creator_information' . $toggle_id . '">' . LF;
         $html .= '<div style="padding:2px;">' . LF;
         $html .= '<div id="form_formatting_box" style="width:97%">' . LF;
         $html .= $text;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
     } else {
         $title = '&nbsp;' . $this->_translator->getMessage('COMMON_TEXT_FORMATING_HELP_SHORT');
         $html .= '<div style="padding-top:0px;">';
         $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA') . ':</div>';
         $text .= $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT');
         // plugins
         $plugin_text = plugin_hook_output_all('getTextFormatingInformationAsHTML', '', BRLF);
         if (!empty($plugin_text)) {
             $text .= $plugin_text;
         }
         //$html .='<img id="toggle'.$item->getItemID().'" src="images/more.gif"/>';
         $html .= '<img id="toggle' . $toggle_id . '" src="images/more.gif"/>';
         $html .= $title;
         //$html .= '<div id="creator_information'.$item->getItemID().'">'.LF;
         $html .= '<div id="creator_information' . $toggle_id . '">' . LF;
         $html .= '<div style="padding:2px;">' . LF;
         $html .= '<div id="form_formatting_box" style="width:97%">' . LF;
         $html .= $text;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
     }
     //$html .='<script type="text/javascript">initTextFormatingInformation("'.$item->getItemID().'",false);</script>';
     $html .= '<script type="text/javascript">initTextFormatingInformation("' . $toggle_id . '",false);</script>';
     $html .= '<!-- END OF FORM-VIEW -->' . LF;
     $current_module = $this->_environment->getCurrentModule();
     if (($current_module == CS_DATE_TYPE or $current_module == CS_TODO_TYPE or $current_module == CS_MATERIAL_TYPE or $current_module == CS_USER_TYPE or $current_module == CS_DISCUSSION_TYPE or $current_module == CS_GROUP_TYPE or $current_module == CS_INSTITUTION_TYPE or $current_module == CS_TOPIC_TYPE or $current_module == CS_SECTION_TYPE or $current_module == CS_DISCARTICLE_TYPE or $current_module == CS_ANNOUNCEMENT_TYPE) and $show_text) {
         return $html;
     } else {
         return '';
     }
 }
Esempio n. 2
0
    include_once 'functions/text_functions.php';
    $_GET = encode(FROM_GET, $_GET);
    // multi master implementation
    $db = $environment->getConfiguration('db');
    if (count($db) > 1) {
        if (!empty($_COOKIE['db_pid'])) {
            $environment->setDBPortalID($_COOKIE['db_pid']);
        } elseif (!empty($_GET['db_pid'])) {
            $environment->setDBPortalID($_GET['db_pid']);
        }
    }
    // multi master implementation - END
    // set current context
    $environment->setCurrentContextID($_GET['cid']);
    // get plugins from plugins
    $text1 = plugin_hook_output_all('getTextFormatingInformationAsHTML', '', BRLF);
    if (!empty($text1)) {
        $text1 = BRLF . $text1;
    } else {
        $text1 = ' ';
    }
}
// text
$translator = $environment->getTranslationObject();
$text = $translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT_JS', $text1, $text2);
if ($text === "COMMON_TEXT_INCLUDING_MEDIA_TEXT_JS") {
    $text = '<table>
									<tr>
									<td>
									<span style="font-weight: bold;">Listen:</span> <span style="font-weight: normal;"># für numerierte, - für unnumerierte Listen</span><br>
									<span style="font-weight: bold;">Auszeichnungen:</span> <span style="font-weight: normal;">*text* wird zu </span> <span style="font-weight: bold;">text</span>, <span style="font-weight: normal;">_text_ wird zu </span><span style="font-weight: normal; font-style: italic;">text</span><br>
Esempio n. 3
0
 public function _getAdditionalViewActionsAsHTML()
 {
     $retour = '';
     $retour .= '   <option value="download">' . $this->_translator->getMessage('COMMON_LIST_ACTION_DOWNLOAD') . '</option>' . LF;
     include_once 'functions/misc_functions.php';
     $retour .= plugin_hook_output_all('getAdditionalViewActionsAsHTML', array('module' => CS_MATERIAL_TYPE), LF);
     return $retour;
 }
Esempio n. 4
0
 function _getFooterAsHTML()
 {
     $retour = '';
     $retour .= LF . '<!-- BEGIN COMMSY FOOTER -->' . LF;
     global $c_plugin_array;
     if (isset($c_plugin_array) and !empty($c_plugin_array)) {
         $plugin_text = '';
         foreach ($c_plugin_array as $plugin) {
             $plugin_class = $this->_environment->getPluginClass($plugin);
             if (method_exists($plugin_class, 'getFooterAsHTML')) {
                 $plugin_text .= $plugin_class->getFooterAsHTML();
             }
             unset($plugin_class);
         }
         if (!empty($plugin_text)) {
             if ($this->_environment->inPortal()) {
                 $retour .= '<div style="padding-left: 20px;">' . LF;
             } elseif ($this->_environment->inServer()) {
                 $retour .= '<div style="padding-left: 200px;">' . LF;
             }
             $retour .= $plugin_text;
             if ($this->_environment->inPortal() or $this->_environment->inServer()) {
                 $retour .= '</div>' . LF;
             }
         }
     }
     $retour .= LF . '<!-- END COMMSY FOOTER -->' . LF;
     // bug in IE7
     // script must be directly before body end tag
     $views = array_merge($this->_views, $this->_views_left, $this->_views_right, $this->_views_overlay);
     if (isset($this->_form_view)) {
         $views[] = $this->_form_view;
     }
     $view = reset($views);
     while ($view) {
         if (method_exists($view, 'getContentForBeforeBodyEndAsHTML')) {
             $retour .= $view->getContentForBeforeBodyEndAsHTML();
         }
         $view = next($views);
     }
     unset($views);
     unset($view);
     // plugins
     $retour .= LF . '   <!-- PLUGINS BEGIN -->' . LF;
     include_once 'functions/misc_functions.php';
     $retour .= plugin_hook_output_all('getInfosForBeforeBodyEndAsHTML', array(), LF, false) . LF;
     $retour .= '   <!-- PLUGINS END -->' . LF . LF;
     return $retour;
 }
 /** get textarea as HTML - internal, do not use
  * this method returns a string contains an textarea in HMTL-Code
  *
  * @param array value form element: textarea, see class cs_form
  *
  * @return string textarea as HMTL
  *
  * @author CommSy Development Group
  */
 function _getTextAreaAsHTML($form_element)
 {
     $html = '';
     if (!empty($form_element['value'])) {
         $form_element['value_for_output'] = $this->_text_as_form($form_element['value']);
         $form_element['value_for_output_html'] = $this->_text_as_form_for_html_editor($form_element['value']);
     } else {
         $form_element['value_for_output'] = '';
         $form_element['value_for_output_html'] = '';
     }
     $form_element['tabindex'] = $this->_count_form_elements;
     $this->_count_form_elements++;
     include_once 'functions/misc_functions.php';
     if ($this->_environment->getCurrentModule() != 'account' and $form_element['with_html_area']) {
         $html = plugin_hook_output_all('getTextAreaAsHTML', $form_element);
     }
     if (empty($html)) {
         global $c_html_textarea;
         $html = '';
         $vsize = '60';
         $normal = '<textarea name="' . $form_element['name'] . '"';
         $normal .= ' cols="' . $form_element['vsize'] . '"';
         $normal .= ' rows="' . $form_element['hsize'] . '"';
         #      $normal .= ' wrap="'.$form_element['wrap'].'"';
         $normal .= ' tabindex="' . $this->_count_form_elements . '"';
         $this->_count_form_elements++;
         if (isset($form_element['is_disabled']) and $form_element['is_disabled']) {
             $normal .= ' disabled="disabled"';
         }
         $normal .= '>';
         $specialTextArea = false;
         if (isset($c_html_textarea) and $c_html_textarea) {
             $specialTextArea = true;
         }
         $normal .= $this->_text_as_form($form_element['value'], $specialTextArea);
         $normal .= '</textarea>' . LF;
         $normal .= LF;
         $current_module = $this->_environment->getCurrentModule();
         $current_function = $this->_environment->getCurrentFunction();
         if ($current_module == 'configuration' and $current_function == 'common' or $current_module == 'configuration' and $current_function == 'preferences' or $current_module == 'project' and $current_function == 'edit' or $current_module == 'community' and $current_function == 'edit') {
             if (isset($form_element['vsize']) and !empty($form_element['vsize'])) {
                 $vsize = $form_element['vsize'];
             }
             $html_status = $form_element['with_html_area_status'];
             if (!empty($html_status) and $html_status != '3') {
                 $with_htmltextarea = true;
                 // control over $form_element['with_html_area']
             } else {
                 $with_htmltextarea = false;
                 // control over $form_element['with_html_area']
             }
         } else {
             $current_context = $this->_environment->getCurrentContextItem();
             $with_htmltextarea = $current_context->withHtmlTextArea();
             $html_status = $current_context->getHtmlTextAreaStatus();
         }
         $current_browser = mb_strtolower($this->_environment->getCurrentBrowser(), 'UTF-8');
         $current_browser_version = $this->_environment->getCurrentBrowserVersion();
         if (!isset($c_html_textarea) or !$c_html_textarea or !$form_element['with_html_area'] or !$with_htmltextarea) {
             $html .= $normal;
         } elseif ($current_browser != 'msie' and $current_browser != 'firefox' and $current_browser != 'netscape' and $current_browser != 'mozilla' and $current_browser != 'camino' and $current_browser != 'opera' and $current_browser != 'safari') {
             $html .= $normal;
         } else {
             $session = $this->_environment->getSessionItem();
             if ($session->issetValue('javascript')) {
                 $javascript = $session->getValue('javascript');
                 if ($javascript == 1) {
                     include_once 'classes/cs_html_textarea.php';
                     $html_area = new cs_html_textarea();
                     $html .= $html_area->getAsHTML($form_element['name'], $this->_text_as_form_for_html_editor($form_element['value'], $specialTextArea), $form_element['hsize'] + 10, $html_status, $this->_count_form_elements, $vsize);
                 } else {
                     $html .= $normal;
                 }
             } else {
                 $html .= $normal;
             }
         }
     } else {
         $html .= LF . $this->_getHiddenFieldasHTML(array('name' => $form_element['name'] . '_is_textarea', 'value' => '1'));
     }
     return $html;
 }
Esempio n. 6
0
 public function __call($name, $arguments)
 {
     // maybe plugin method
     // first argument = session id or json-string with session id
     $sid = '';
     if (!empty($arguments[0])) {
         // 32 = length of md5 hash
         if (strlen($arguments[0]) == 32) {
             $sid = $arguments[0];
         } else {
             $arg_array = json_decode($arguments[0], true);
             if (empty($arg_array)) {
                 $arg_array = json_decode(str_replace('\'', '"', $arguments[0]), true);
             }
             if (!empty($arg_array['SID'])) {
                 $sid = $arg_array['SID'];
             } elseif (!empty($arg_array['sid'])) {
                 $sid = $arg_array['sid'];
             }
         }
     }
     // now the context
     if (!empty($sid)) {
         // session valid ?
         if ($this->_isSessionValid($sid)) {
             // get session item
             $session_manager = $this->_environment->getSessionManager();
             $session_item = $session_manager->get($sid);
             if ($session_item->issetValue('commsy_id')) {
                 $portal_id = $session_item->getValue('commsy_id');
                 $this->_environment->setCurrentPortalID($portal_id);
                 $this->_environment->setCurrentContextID($portal_id);
                 // plugin function
                 $retour = plugin_hook_output_all($name, $arguments);
             } else {
                 return new SoapFault('ERROR', 'can not find portal id in session item');
             }
         } else {
             return new SoapFault('ERROR', 'Session (' . $sid . ') not valid!');
         }
     }
     // return
     if (!empty($retour)) {
         return $retour;
     } else {
         return new SoapFault('ERROR', 'SOAP function (' . $name . ') is not defined');
     }
 }
Esempio n. 7
0
    $environment = new cs_environment();
    if (!empty($_GET['plugin'])) {
        // full wsdl only for plugin
        $plugin_name = $_GET['plugin'];
        $plugin_class = $environment->getPluginClass($plugin_name);
        if (!empty($plugin_class) and method_exists($plugin_class, 'getFullWSDL')) {
            $wsdl = $plugin_class->getFullWSDL();
            unset($plugin_class);
            if (!empty($wsdl)) {
                echo $wsdl;
                exit;
            }
        }
    } else {
        // merge plugin soap functions into CommSy soap functions
        $soap_functions_array = plugin_hook_output_all('getSOAPAPIArray', array(), 'ARRAY');
    }
}
// soap_functions from classes
if (!isset($environment)) {
    include_once 'etc/cs_constants.php';
    include_once 'etc/cs_config.php';
    include_once 'functions/misc_functions.php';
    include_once 'classes/cs_environment.php';
    $environment = new cs_environment();
}
$connection_obj = $environment->getCommSyConnectionObject();
if (!empty($connection_obj)) {
    $soap_functions_array_from_class = $connection_obj->getSoapFunctionArray();
    if (!empty($soap_functions_array_from_class)) {
        $soap_functions_array = array_merge($soap_functions_array, $soap_functions_array_from_class);
Esempio n. 8
0
 private function getListActions()
 {
     $return = array();
     // add no action
     $return[] = array('selected' => true, 'disabled' => false, 'id' => '', 'value' => CS_LISTOPTION_NONE, 'display' => '___COMMON_LIST_ACTION_NO___');
     // add separator
     $return[] = array('selected' => false, 'disabled' => true, 'id' => '', 'value' => '', 'display' => '------------------------------');
     // TODO: clipboard mode
     //$session = $this->_environment->getSessionItem();
     //if(	!isset($this->_list_parameter_arrray['clipboard_id_array']) ||
     //	!$session->issetValue($this->_environment->getCurrentModule() . '_clipboard', $this->_list_parameter_arrray['clipboard_id_array'])) {
     // clipboard is empty
     $return[] = array('selected' => false, 'disabled' => false, 'id' => '', 'value' => CS_LISTOPTION_MARK_AS_READ, 'display' => '___COMMON_LIST_ACTION_MARK_AS_READ___');
     $return = array_merge($return, $this->getAdditionalListActions());
     $return[] = array('selected' => false, 'disabled' => true, 'id' => '', 'value' => '', 'display' => '------------------------------');
     if ($this->_environment->getCurrentModule() != 'user') {
         if ($this->_environment->inPrivateRoom()) {
             $return[] = array('selected' => false, 'disabled' => false, 'id' => '', 'value' => CS_LISTOPTION_DELETE, 'display' => '___COMMON_LIST_ACTION_DELETE___');
         } else {
             $user = $this->_environment->getCurrentUserItem();
             if ($user->isModerator()) {
                 $return[] = array('selected' => false, 'disabled' => false, 'id' => '', 'value' => CS_LISTOPTION_DELETE, 'display' => '___COMMON_LIST_ACTION_DELETE___');
             } else {
                 $return[] = array('selected' => false, 'disabled' => true, 'id' => '', 'value' => CS_LISTOPTION_DELETE, 'display' => '___COMMON_LIST_ACTION_DELETE___');
             }
         }
     } else {
         $return[] = array('selected' => false, 'disabled' => false, 'id' => '', 'value' => CS_LISTOPTION_EMAIL_SEND, 'display' => '___USER_LIST_ACTION_EMAIL_SEND___');
     }
     // TODO: move to cs_todo_index_controller.php
     if ($this->_environment->getCurrentModule() == 'todo') {
         $return[] = array('selected' => false, 'disabled' => true, 'id' => '', 'value' => '', 'display' => '------------------------------');
         $user = $this->_environment->getCurrentUserItem();
         if ($user->isModerator()) {
             $return[] = array('selected' => false, 'disabled' => false, 'id' => '', 'value' => CS_LISTOPTION_TODO_DONE, 'display' => '___TODO_LIST_ACTION_DONE___');
             $return[] = array('selected' => false, 'disabled' => false, 'id' => '', 'value' => CS_LISTOPTION_TODO_IN_PROGRESS, 'display' => '___TODO_LIST_ACTION_IN_PROGRESS___');
             $return[] = array('selected' => false, 'disabled' => false, 'id' => '', 'value' => CS_LISTOPTION_TODO_NOT_STARTED, 'display' => '___TODO_LIST_ACTION_NOT_STARTED___');
         } else {
             $return[] = array('selected' => false, 'disabled' => true, 'id' => '', 'value' => '', 'display' => '___TODO_LIST_ACTION_DONE___');
             $return[] = array('selected' => false, 'disabled' => true, 'id' => '', 'value' => '', 'display' => '___TODO_LIST_ACTION_IN_PROGRESS___');
             $return[] = array('selected' => false, 'disabled' => true, 'id' => '', 'value' => '', 'display' => '___TODO_LIST_ACTION_NOT_STARTED___');
         }
     }
     //} else {
     //	// clipboard is not empty
     //	$return[] = array('selected' => false, 'disabled' => false, 'id' => '', 'value' => 1, 'display' => '___CLIPBOARD_PASTE_BUTTON___');
     //	$return[] = array('selected' => false, 'disabled' => false, 'id' => '', 'value' => 2, 'display' => '___CLIPBOARD_DELETE_BUTTON___');
     //}
     // plugins
     $plugin_options = plugin_hook_output_all('getAdditionalListOptions', NULL, 'MULTIARRAY');
     if (!empty($plugin_options)) {
         // add separator
         $return[] = array('selected' => false, 'disabled' => true, 'id' => '', 'value' => '', 'display' => '------------------------------');
         $return = array_merge($return, $plugin_options);
     }
     // plugins
     return $return;
 }
Esempio n. 9
0
 function getMyAreaAsHTML()
 {
     $get_vars = $this->_environment->getCurrentParameterArray();
     $post_vars = $this->_environment->getCurrentPostParameterArray();
     $current_context = $this->_environment->getCurrentContextItem();
     $current_portal = $this->_environment->getCurrentPortalItem();
     if (!empty($get_vars['cs_modus'])) {
         $cs_mod = $get_vars['cs_modus'];
     } elseif (!empty($post_vars['cs_modus'])) {
         $cs_mod = $post_vars['cs_modus'];
     } else {
         $cs_mod = '';
     }
     unset($get_vars);
     unset($post_vars);
     $html = '<div style="white-space:nowrap;">';
     if ($this->_with_personal_area) {
         if (!empty($this->_current_user) and ($this->_current_user->getUserID() == 'guest' and $this->_current_user->isGuest()) and !$this->_environment->inServer()) {
             $html .= $this->_translator->getMessage('MYAREA_LOGIN_NOT_LOGGED_IN');
             if ($current_context->isOpenForGuests() and !$this->_current_user->isUser() and !$this->_environment->inServer() and !$this->_environment->inPortal()) {
                 $html .= ' (' . $this->_translator->getMessage('MYAREA_LOGIN_AS_GUEST') . ') ';
             }
             $params = array();
             $params['room_id'] = $this->_environment->getCurrentContextID();
             $params['login_redirect'] = true;
             $html .= '&nbsp;&nbsp;|&nbsp;&nbsp;' . ahref_curl($this->_environment->getCurrentPortalID(), 'home', 'index', $params, $this->_translator->getMessage('MYAREA_LOGIN_BUTTON'), '', '', '', '', '', '', 'style="color:#800000"') . '' . LF;
             // @segment-end 77327
             // @segment-begin 69973 no-cs_modus/user=guest:if-logged-in-as-guest
         } elseif (!$this->_environment->inServer() and !empty($this->_current_user)) {
             $params = array();
             $params['iid'] = $this->_current_user->getItemID();
             $fullname = $this->_current_user->getFullname();
             $html .= $fullname;
             if ($current_context->isOpenForGuests() and !$this->_current_user->isUser() and !$this->_environment->inServer() and !$this->_environment->inPortal()) {
                 $html .= ' (' . $this->_translator->getMessage('MYAREA_LOGIN_AS_GUEST') . ') ';
             }
             $html .= '&nbsp;&nbsp;|&nbsp;&nbsp;' . ahref_curl($this->_environment->getCurrentContextID(), 'context', 'logout', $params, $this->_translator->getMessage('MYAREA_LOGOUT'), '', '', '', '', '', '', 'style="color:#800000"') . '' . LF;
             $params = $this->_environment->getCurrentParameterArray();
             $params['uid'] = $this->_current_user->getItemID();
             $params['show_profile'] = 'yes';
             unset($params['is_saved']);
             unset($params['show_copies']);
             unset($params['profile_page']);
             if (!empty($params['mode'])) {
                 unset($params['mode']);
             }
             if (!empty($params['download'])) {
                 unset($params['download']);
             }
             global $c_annonymous_account_array;
             if (empty($c_annonymous_account_array[mb_strtolower($this->_current_user->getUserID(), 'UTF-8') . '_' . $this->_current_user->getAuthSource()]) and !$this->_current_user->isOnlyReadUser()) {
                 $html .= '&nbsp;&nbsp;|&nbsp;&nbsp;' . ahref_curl($this->_environment->getCurrentContextID(), $this->_environment->getCurrentModule(), $this->_environment->getCurrentFunction(), $params, $this->_translator->getMessage('MYAREA_PROFILE'), '', '', '', '', '', '', 'style="color:#800000"') . '' . LF;
                 $html .= $this->_getCopyLinkAsHTML();
             }
             // plugins for users
             $plugin_html = plugin_hook_output_all('getMyAreaActionAsHTML', array(), '&nbsp;');
             if (!empty($plugin_html)) {
                 $html .= '&nbsp;&nbsp;|&nbsp;&nbsp;' . $plugin_html;
             }
             $html .= $this->_getFlagsAsHTML();
         }
     }
     if ($this->_with_personal_area and empty($cs_mod)) {
         if (!($this->_environment->inServer() and $this->_current_user->isGuest())) {
             $params = array();
             if ($this->_environment->inServer()) {
                 if ($this->_current_user->isRoot()) {
                     $html .= '<tr>';
                     $html .= '<td colspan ="2">';
                     $html .= '<span> ' . ahref_curl($this->_environment->getServerID(), 'home', 'index', '', '<img src="images/door_open_small.gif" style="vertical-align: middle" alt="door open"/>') . LF;
                     $html .= ahref_curl($this->_environment->getServerID(), 'home', 'index', '', $this->_translator->getMessage('MYAREA_LOGIN_TO_ALL_PORTALS'), '', '', '', '', '', '', 'style="color:#800000"') . '</span>' . LF;
                     $html .= '</td>';
                     $html .= '</tr>';
                 }
             }
             unset($current_context);
             unset($current_portal);
         }
     }
     $html .= '</div>';
     return $html;
 }
Esempio n. 10
0
 private function getConfigContent()
 {
     $return = array();
     $current_context = $this->_environment->getCurrentContextItem();
     $translator = $this->_environment->getTranslationObject();
     // user id
     $return['user_id'] = $this->_item->getUserID();
     // portal
     $portal_item = $this->_environment->getCurrentPortalItem();
     if ($portal_item->getCountAuthSourceListEnabled() !== 1) {
         $return['auth_source'] = $portal_item->getAuthSource($this->_item->getAuthSource())->getTitle();
     }
     if (!$this->_environment->inPrivateRoom()) {
         // status
         $status = '';
         if ($this->_item->isModerator()) {
             $status = $translator->getMessage('USER_STATUS_MODERATOR');
         } elseif ($this->_item->isUser()) {
             $status = $translator->getMessage('USER_STATUS_USER');
         } elseif ($this->_item->isRequested()) {
             $status = $translator->getMessage('USER_STATUS_REQUESTED');
         } else {
             if (!$current_context->isCommunityRoom()) {
                 $status = $translator->getMessage('USER_STATUS_CLOSED');
             } else {
                 $last_login = $this->_item->getLastlogin();
                 if (!empty($last_login)) {
                     $status = $translator->getMessage('USER_STATUS_CLOSED');
                 } else {
                     $status = $translator->getMessage('USER_STATUS_REJECT');
                 }
             }
         }
         $return['status'] = $status;
         // contact
         if ($this->_item->isContact()) {
             $return['contact'] = 'common_yes';
         } elseif ($this->_item->isModerator()) {
             $return['contact'] = 'common_no';
         }
         // language
         $language = $current_context->getLanguage();
         if (mb_strtoupper($language, 'UTF-8') === 'USER' || $this->_display_mod === 'admin' && $this->_environment->inPortal()) {
             switch (cs_strtoupper($this->_item->getLanguage())) {
                 case 'BROWSER':
                     $return['language'] = 'browser';
                     break;
                 default:
                     $return['language'] = $translator->getLanguageLabelTranslated($this->_item->getLanguage());
                     break;
             }
         }
     }
     // visibility
     if ($this->_environment->inCommunityRoom()) {
         if ($current_context->isOpenForGuests()) {
             if ($this->_item->isVisibleForAll()) {
                 $return['visibility'] = 'always';
             } else {
                 $return['visibility'] = 'only_logged';
             }
         }
     }
     // mailing
     if ($this->_item->isModerator() && !$this->_environment->inPrivateRoom()) {
         $temp_extra = cs_strtoupper($this->_item->getAccountWantMail());
         // text_functions, respectively cs_user_item.php
         switch ($temp_extra) {
             case 'YES':
                 $return['mailing'] = 'yes';
                 break;
             case 'NO':
                 $return['mailing'] = 'no';
                 break;
             default:
                 $return['mailing'] = 'error';
                 break;
         }
         $temp_extra = cs_strtoupper($this->_item->getOpenRoomWantMail());
         switch ($temp_extra) {
             case 'YES':
                 $return['mailing_room'] = 'yes';
                 break;
             case 'NO':
                 $return['mailing_room'] = 'no';
                 break;
             default:
                 $return['mailing_room'] = 'error';
                 break;
         }
         $temp_extra = cs_strtoupper($this->_item->getDeleteEntryWantMail());
         switch ($temp_extra) {
             case 'YES':
                 $return['mailing_delete_entries'] = 'yes';
                 break;
             case 'NO':
                 $return['mailing_delete_entries'] = 'no';
                 break;
             default:
                 $return['mailing_delete_entries'] = 'error';
                 break;
         }
         if ($this->_environment->inCommunityRoom()) {
             if ($current_context->isOpenForGuests()) {
                 $temp_extra = cs_strtoupper($this->_item->getPublishMaterialWantMail());
                 switch ($temp_extra) {
                     case 'YES':
                         $return['mailing_material'] = 'yes';
                         break;
                     case 'NO':
                         $return['mailing_material'] = 'no';
                         break;
                     default:
                         $return['mailing_material'] = 'error';
                         break;
                 }
             }
         }
     }
     if ($this->_environment->inPortal()) {
         $related_user_array = array();
         $Related_user_list = $this->_item->getRelatedUserList();
         if ($related_user_list->isNotEmpty()) {
             $user_item = $related_user_list->getFirst();
             while ($user_item) {
                 $related_user_array[$user_item->getContextID()] = $user_item;
                 $user_item = $related_user_list->getNext();
             }
             unset($related_user_list);
         }
         // TODO: migrate
         /*
         *
         
                $temp_array = array();
                $formal_data[] = $temp_array;
                unset($temp_array);
         
                $temp_array = array();
                $temp_array[] = $this->_translator->getMessage('USER_ROOM_MEMBERSHIPS');
                $formal_data[] = $temp_array;
                unset($temp_array);
         
                $temp_array = array();
                $temp_array[] = $this->_translator->getMessage('COMMUNITYS');
         
                $community_list = $item->getRelatedCommunityList();
                if ($community_list->isNotEmpty()) {
                   $community_item = $community_list->getFirst();
                   $first = true;
                   $temp_string = '';
                   while ($community_item) {
                     if ($first) {
                        $first = false;
                     } else {
                        $temp_string .= BRLF;
                     }
                     $temp_string .= $community_item->getTitle();
         
                     // status
                         $status = $this->_getStatus($related_user_array[$community_item->getItemID()],$community_item);
                     if (!empty($status)) {
                        $temp_string .= ' ('.$status.')';
                     }
                     unset($community_item);
                     $community_item = $community_list->getNext();
                  }
                  $temp_array[] = $temp_string;
                  unset($temp_string);
                  unset($community_list);
                } else {
                   $temp_array[] = '<span class="disabled">'.$this->_translator->getMessage('COMMON_NONE').'</span>';
                }
                $formal_data[] = $temp_array;
                unset($temp_array);
         
                $temp_array = array();
                $temp_array[] = $this->_translator->getMessage('PROJECTS');
         
                $room_list = $item->getRelatedProjectList();
                if ($room_list->isNotEmpty()) {
                   $room_item = $room_list->getFirst();
                   $first = true;
                   $temp_string = '';
                   while ($room_item) {
                     if ($first) {
                        $first = false;
                     } else {
                        $temp_string .= BRLF;
                     }
                     $temp_string .= $room_item->getTitle();
                     // room status
                         if ($room_item->isLocked()) {
                            $temp_string .= ' ['.$this->_translator->getMessage('PROJECTROOM_LOCKED').']'.LF;
                         } elseif ($room_item->isClosed()) {
                            $temp_string .= ' ['.$this->_translator->getMessage('PROJECTROOM_CLOSED').']'.LF;
                         }
                     // status
                         $status = $this->_getStatus($related_user_array[$room_item->getItemID()],$room_item);
                     if (!empty($status)) {
                        $temp_string .= ' ('.$status.')';
                     }
                     unset($room_item);
                     $room_item = $room_list->getNext();
                  }
                  $temp_array[] = $temp_string;
                  unset($temp_string);
                  unset($room_list);
                } else {
                   $temp_array[] = '<span class="disabled">'.$this->_translator->getMessage('COMMON_NONE').'</span>';
                }
                $formal_data[] = $temp_array;
                unset($temp_array);
                unset($related_user_list);
         */
     }
     if ($this->_environment->inPrivateRoom()) {
         // TODO: migrate
         /*
         * $temp_array = array();
                  $temp_array[] = $this->_translator->getMessage('CONFIGURATION_AUTOSAVE_STATUS');
                  if ( $item->isAutoSaveOn() ) {
                     $temp_array[] = $this->_translator->getMessage('COMMON_YES');
                  } else {
                     $temp_array[] = $this->_translator->getMessage('COMMON_NO');
                  }
                  $formal_data[] = $temp_array;
         */
     }
     // plugin
     include_once 'functions/misc_functions.php';
     $return['plugin_array'] = plugin_hook_output_all('getUserDetailConfigArray', array('user_item' => $this->_item), 'MULTIARRAY');
     return $return;
 }
Esempio n. 11
0
 function _getDetailActionsAsHTML($item)
 {
     $current_context = $this->_environment->getCurrentContextItem();
     $current_user = $this->_environment->getCurrentUserItem();
     $html = '';
     $html .= $this->_getDetailItemActionsAsHTML($item);
     $html .= $this->_getAdditionalActionsAsHTML($item);
     $html .= $this->_getPrintAction($item, $current_user);
     if (!$this->_environment->inPrivateRoom()) {
         $html .= $this->_getMailAction($item, $current_user);
     }
     $html .= $this->_getDownloadAction($item, $current_user);
     $html .= $this->_getCopyAction($item, $current_user);
     // actions from rubric plugins
     $html .= plugin_hook_output_all('getDetailActionAsHTML', NULL, LF);
     $html .= $this->_getNewAction($item, $current_user);
     $html .= $this->_initDropDownMenus();
     return $html;
 }
Esempio n. 12
0
 private function getDetailActions()
 {
     $current_context = $this->_environment->getCurrentContextItem();
     $current_user = $this->_environment->getCurrentUserItem();
     $return = array('edit' => false, 'delete' => false, 'mail' => false, 'copy' => false, 'new' => false, 'locked' => false);
     // edit
     if (isset($this->_item) and $this->_item->mayEdit($current_user) && $this->_with_modifying_actions && !$this->_item->isSystemLabel()) {
         $return['edit'] = true;
     } else {
         $checkLocking = $this->_environment->getConfiguration('c_item_locking');
         $checkLocking = $checkLocking ? $checkLocking : false;
         if ($checkLocking && method_exists($this->_item, "getLockingDate")) {
             $lockingDate = $this->_item->getLockingDate();
             if ($lockingDate) {
                 $editDate = new DateTime($lockingDate);
                 $compareDate = new DateTime();
                 $compareDate->modify("-20 minutes");
                 $return['locked'] = $compareDate < $editDate;
                 $userManager = $this->_environment->getUserManager();
                 $lockingUser = $userManager->getItem($this->_item->getLockingUserId());
                 $return['locked_user_name'] = $lockingUser->getFullName();
                 $return['locked_date'] = $this->_environment->getTranslationObject()->getDateTimeinLang($lockingDate);
             }
         }
     }
     // delete
     if (isset($this->_item) and $this->_item->mayEdit($current_user) && $this->_with_modifying_actions && (!$this->_item->isA(CS_LABEL_TYPE) || !$this->_item->isSystemLabel())) {
         $return['delete'] = true;
     } else {
     }
     $this->getAdditionalActions($return);
     // mail
     if (!$this->_environment->inPrivateRoom()) {
         $module = 'rubric';
         //$text = $this->_translator->getMessage('COMMON_EMAIL_TO');
         if ($current_user->isUser() && $this->_with_modifying_actions) {
             $return['mail'] = true;
         } else {
         }
     }
     // copy
     if ($current_user->isUser() && isset($this->_item) and !in_array($this->_item->getItemID(), $this->_clipboard_id_array)) {
         $return['copy'] = true;
     } else {
     }
     // TODO: dont forget print, download - which are always allowed
     // TODO:  // actions from rubric plugins
     if ($current_context->isPluginActive("voyeur")) {
         $plugin_actions = plugin_hook_output('voyeur', 'getDetailActionAsHTML', NULL, ' | ');
         if (!empty($plugin_actions)) {
             if ($current_context->isPrivateRoom()) {
                 $plugin_actions = str_replace("iid=", "iid=" . $this->_item->getItemID(), $plugin_actions);
             }
             $return['plugins'] = true;
             $return['plugins_html'] = $plugin_actions;
         }
     }
     $except[] = 'voyeur';
     $plugin_actions = plugin_hook_output_all('getDetailActionAsHTML', NULL, ' | ', '', $except);
     if (!empty($plugin_actions)) {
         $return['plugins'] = true;
         $return['plugins_html'] = $plugin_actions;
     }
     // new
     $current_module = $this->_environment->getCurrentModule();
     if ($current_user->isUser() && $this->_with_modifying_actions && $current_module != CS_USER_TYPE) {
         $return['new'] = true;
     } else {
     }
     if ($current_context->isMaterialOpenForGuests() && $current_user->isGuest()) {
         $return['edit'] = false;
         $return['delete'] = false;
         $return['mail'] = false;
         $return['copy'] = false;
     }
     // grouproom
     if ($this->_item->getType() == 'label' && $this->_item->getLabelType() == 'group') {
         if ($this->_item->isGroupRoomActivated()) {
             $return['grouproom'] = $this->_item->getGroupRoomItemID();
         } else {
             $return['grouproom'] = false;
         }
     }
     // download
     $return['downloadparams'] = $this->_environment->getCurrentParameterArray();
     $return['downloadparams']['download'] = 'zip';
     $return['downloadparams']['mode'] = 'print';
     //TODO:
     //$html .= $this->_initDropDownMenus();
     return $return;
 }
Esempio n. 13
0
 public function _newFormating($text)
 {
     $file_array = $this->_getFileArray();
     #$temp = $this->_environment->getCurrentContextItem();
     #pr($temp);
     //////////////////////////////////////////////////////////////
     // this is for preventing parsing of (: and :)
     //////////////////////////////////////////////////////////////
     // decode tags used in alt and text attributes
     #$attr = array('alt', 'text');
     #$text = $this->_encode_attr($attr, $text);
     // decode file names
     #$text = $this->_encode_file_names($text);
     //////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////
     $reg_exp_father_array = array();
     $reg_exp_father_array[] = '~\\(:(.*?):\\)~eu';
     $reg_exp_father_array[] = '~\\[(.*?)\\]~eu';
     $reg_exp_array = array();
     // reference
     #$reg_exp_array['[']			  = '~\\[[0-9]+\|[\w]+\]~eu';
     $reg_exp_array['(:flash'] = '~\\(:flash\\s(.*?:){0,1}(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:quicktime'] = '~\\(:quicktime\\s(.*?:){0,1}(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:wmplayer'] = '~\\(:wmplayer\\s(.*?:){0,1}(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:image'] = '~\\(:image\\s(.*?:){0,1}(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:item'] = '~\\(:item\\s([0-9]*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:link'] = '~\\(:link\\s(.*?:){0,1}(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:file'] = '~\\(:file\\s(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:zip'] = '~\\(:zip\\s(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:youtube'] = '~\\(:youtube\\s(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:podcampus'] = '~\\(:podcampus\\s(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:googlevideo'] = '~\\(:googlevideo\\s(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:vimeo'] = '~\\(:vimeo\\s(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:mp3'] = '~\\(:mp3\\s(.*?:){0,1}(.*?)(\\s.*?)?\\s*?:\\)~eu';
     $reg_exp_array['(:lecture2go'] = '~\\(:lecture2go\\s(.*?)(\\s.*?)?\\s*?:\\)~eu';
     if ($this->_environment->isScribdAvailable()) {
         $reg_exp_array['(:office'] = '~\\(:office\\s(.*?)(\\s.*?)?\\s*?:\\)~eu';
     }
     $reg_exp_array['(:slideshare'] = '~\\(:slideshare\\s(.*?):\\)~eu';
     $reg_exp_array['[slideshare'] = '~\\[slideshare\\s(.*?)\\]~eu';
     $reg_exp_array['(:flickr'] = '~\\(:flickr\\s(.*?):\\)~eu';
     $reg_exp_array['(:scorm'] = '~\\(:scorm\\s(.*?):\\)~eu';
     $reg_exp_array['(:mdo'] = '~\\(:mdo\\s(.*?):\\)~eu';
     $reg_exp_array['(:geogebra'] = '~\\(:geogebra\\s(.*?):\\)~eu';
     $reg_exp_array['(:scratch'] = '~\\(:scratch\\s(.*?:){0,1}(.*?)(\\s.*?)?\\s*?:\\)~eu';
     // Test auf erforderliche Software; Windows-Server?
     //$reg_exp_array['(:pdf']       = '/\\(:pdf (.*?)(\\s.*?)?\\s*?:\\)/e';
     // Lightbox für Bilder die über den CkEditor in das Beschreibungsfeld eingefügt wurden
     $reg_exp_image['<img'] = '~\\<img(.*?)\\>~eu';
     // \<img.*?\>
     #$reg_exp_image['link']		  = '~<a(.*?)><img(.*?)></a>~eu'; // \<img.*?\>
     // plugins
     $plugin_reg_exp_array = plugin_hook_output_all('getMediaRegExp', null, 'ARRAY');
     if (!empty($plugin_reg_exp_array)) {
         $reg_exp_array = array_merge($reg_exp_array, $plugin_reg_exp_array);
     }
     // jsMath for latex math fonts
     // see http://www.math.union.edu/~dpvc/jsMath/
     global $c_jsmath_enable;
     if (isset($c_jsmath_enable) and $c_jsmath_enable) {
         $reg_exp_father_array[] = '~\\{\\$[\\$]{0,1}(.*?)\\$[\\$]{0,1}\\}~eu';
         $reg_exp_array['{$$'] = '~\\{\\$\\$(.*?)\\$\\$\\}~eu';
         // must be before next one
         $reg_exp_array['{$'] = '~\\{\\$(.*?)\\$\\}~eu';
     }
     // is there wiki syntax ?
     if (!empty($reg_exp_array)) {
         $reg_exp_keys = array_keys($reg_exp_array);
         $clean_text = false;
         foreach ($reg_exp_keys as $key) {
             if (mb_stristr($text, $key)) {
                 $clean_text = true;
                 break;
             }
         }
     }
     ############ lightbox images ckEditor ###############
     $matchesImages = array();
     $found_link = preg_match_all('~<a.*?>(<img.*?>)</a>~eu', $text, $matchesLink);
     foreach ($reg_exp_image as $key => $exp) {
         $found = preg_match_all($exp, $text, $matchesImages);
         if ($found > 0) {
             foreach ($matchesImages[0] as $value) {
                 // found an <a> tag dont use lightbox
                 if (!in_array($value, $matchesLink[1])) {
                     // found an image tag
                     $args_array = $this->_getArgs($value, $exp);
                     // search for src attribute
                     $src = $this->_getArgs($args_array[1], '~src\\=\\"(.*?)\\"~eu');
                     $value_new = $value;
                     if ($key == '<img' and mb_stristr($value_new, '<img')) {
                         $params = $this->_environment->getCurrentParameterArray();
                         $tempArray[0] = $args_array[0];
                         $tempArray[2] = $src[1];
                         $tempArray[3] = $args_array[1];
                         $value_new = $this->_formatImageLightboxCkEditor($text, $args_array[0], $src[1], $params['iid']);
                         $text = str_replace($value, $value_new, $text);
                         unset($value_new);
                     }
                 }
             }
         }
     }
     ############ lightbox images ckEditor ###############
     // clean wikistyle text from HTML-Code (via fckeditor)
     // and replace wikisyntax
     if ($clean_text) {
         $matches = array();
         foreach ($reg_exp_father_array as $exp) {
             $found = preg_match_all($exp, $text, $matches);
             if ($found > 0) {
                 $matches[0] = array_unique($matches[0]);
                 // doppelte einsparen
                 foreach ($matches[0] as $value) {
                     # delete HTML-tags and string conversion #########
                     $value_new = strip_tags($value);
                     $value_new = str_replace('&nbsp;', ' ', $value_new);
                     ##################################################
                     foreach ($reg_exp_array as $key => $reg_exp) {
                         $check = false;
                         $args_array = $this->_getArgs($value_new, $reg_exp);
                         foreach ($args_array as $arg_value) {
                             if (strstr($arg_value, "'") and substr_count($arg_value, "'") % 2 == 1) {
                                 $check = true;
                                 break;
                             }
                         }
                         if ($check) {
                             $value = $this->_getSubText($text, $value);
                             # delete HTML-tags and string conversion #########
                             $value_new = strip_tags($value);
                             $value_new = str_replace('&nbsp;', ' ', $value_new);
                             ##################################################
                             $args_array = $this->_getArgs2($value_new, $reg_exp);
                         }
                         // decode file names
                         #$value_new = $this->_decode_file_names($value_new);
                         /*if ( $key == '[' and mb_stristr($value_new,'[') ){#pr($args_array);
                           	$value_new = $this->_formatRef($value_new,$args_array); // Referenzen Testen
                           } else*/
                         if ($key == '(:flash' and mb_stristr($value_new, '(:flash')) {
                             $value_new = $this->_formatFlash($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:wmplayer' and mb_stristr($value_new, '(:wmplayer')) {
                             $value_new = $this->_formatWmplayer($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:quicktime' and mb_stristr($value_new, '(:quicktime')) {
                             $value_new = $this->_formatQuicktime($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:image' and mb_stristr($value_new, '(:image')) {
                             $value_new = $this->_formatImage($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:item' and mb_stristr($value_new, '(:item')) {
                             $value_new = $this->_formatItem($value_new, $args_array);
                             break;
                         } elseif ($key == '(:link' and mb_stristr($value_new, '(:link')) {
                             $value_new = $this->_formatLink($value_new, $args_array);
                             break;
                         } elseif ($key == '(:file' and mb_stristr($value_new, '(:file')) {
                             $value_new = $this->_formatFile($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:zip' and mb_stristr($value_new, '(:zip')) {
                             $value_new = $this->_formatZip($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:youtube' and mb_stristr($value_new, '(:youtube')) {
                             $value_new = $this->_formatYoutube($value_new, $args_array);
                             break;
                         } elseif ($key == '(:podcampus' and mb_stristr($value_new, '(:podcampus')) {
                             $value_new = $this->_formatPodcampus($value_new, $args_array);
                             break;
                         } elseif ($key == '(:googlevideo' and mb_stristr($value_new, '(:googlevideo')) {
                             $value_new = $this->_formatGooglevideo($value_new, $args_array);
                             break;
                         } elseif ($key == '(:vimeo' and mb_stristr($value_new, '(:vimeo')) {
                             $value_new = $this->_formatVimeo($value_new, $args_array);
                             break;
                         } elseif ($key == '(:mp3' and mb_stristr($value_new, '(:mp3')) {
                             $value_new = $this->_formatMP3($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:lecture2go' and mb_stristr($value_new, '(:lecture2go')) {
                             $value_new = $this->_formatLecture2go($value_new, $args_array);
                             break;
                         } elseif ($key == '(:office' and mb_stristr($value_new, '(:office')) {
                             $value_new = $this->_formatOffice($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:pdf' and mb_stristr($value_new, '(:pdf')) {
                             $value_new = $this->_formatPDF($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:slideshare' and mb_stristr($value_new, '(:slideshare')) {
                             $value_new = $this->_formatSlideshare($value_new, $args_array);
                             break;
                         } elseif ($key == '[slideshare' and mb_stristr($value_new, '[slideshare')) {
                             $value_new = $this->_formatSlideshare($value_new, $args_array);
                             break;
                         } elseif ($key == '{$' and mb_stristr($value_new, '{$')) {
                             $value_new = $this->_formatMath($value_new, $args_array, 'span');
                             break;
                         } elseif ($key == '{$$' and mb_stristr($value_new, '{$$')) {
                             $value_new = $this->_formatMath($value_new, $args_array, 'div');
                             break;
                         } elseif ($key == '(:flickr' and mb_stristr($value_new, '(:flickr')) {
                             $value_new = $this->_formatFlickr($value_new, $args_array);
                             break;
                         } elseif ($key == '(:scorm' and mb_stristr($value_new, '(:scorm')) {
                             $value_new = $this->_formatScorm($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:mdo' and mb_stristr($value_new, '(:mdo')) {
                             $value_new = $this->_formatMDO($value_new, $args_array);
                             break;
                         } elseif ($key == '(:geogebra' and mb_stristr($value_new, '(:geogebra')) {
                             $value_new = $this->_formatGeogebra($value_new, $args_array, $file_array);
                             break;
                         } elseif ($key == '(:scratch' and mb_stristr($value_new, '(:scratch')) {
                             $value_new = $this->_formatScratch($value_new, $args_array, $file_array);
                         } else {
                             $value_new_plugin = plugin_hook_output_all('formatMedia', array('key' => $key, 'value_new' => $value_new, 'args_array' => $args_array, 'file_array' => $file_array), 'ONE');
                             if (!empty($value_new_plugin)) {
                                 $value_new = $value_new_plugin;
                             }
                         }
                     }
                     $text = str_replace($value, $value_new, $text);
                 }
             }
         }
         if ($this->_processMath) {
             $text .= '<script type="text/javascript">jsMath.Process();</script>' . LF;
         }
     }
     return $text;
 }
Esempio n. 14
0
 /**
  * process basic template information
  */
 private function processBaseTemplate()
 {
     $current_user = $this->_environment->getCurrentUser();
     $own_room_item = $current_user->getOwnRoom();
     $portal_user = $current_user->getRelatedPortalUserItem();
     $portal_item = $this->_environment->getCurrentPortalItem();
     $current_context = $this->_environment->getCurrentContextItem();
     $translator = $this->_environment->getTranslationObject();
     $portal_user_item = $current_user->getRelatedPortalUserItem();
     if ($portal_user_item) {
         $this->assign('environment', 'user_language', $portal_user_item->getLanguage());
     }
     $count_new_accounts = 0;
     if ($current_user->isModerator()) {
         // user count
         $manager = $this->_environment->getUserManager();
         $manager->resetLimits();
         $manager->setContextLimit($this->_environment->getCurrentContextID());
         $manager->setStatusLimit(1);
         $manager->select();
         $user = $manager->get();
         $count_new_accounts = 0;
         if ($user->getCount() > 0) {
             $count_new_accounts = $user->getCount();
         }
         // // tasks
         // $manager = $this->_environment->getTaskManager();
         // $manager->resetLimits();
         // $manager->setContextLimit($this->_environment->getCurrentContextID());
         // $manager->setStatusLimit('REQUEST');
         // $manager->select();
         // $tasks = $manager->get();
         // $task = $tasks->getFirst();
         // $count_new_accounts = 0;
         // while($task){
         //    $mode = $task->getTitle();
         //    $task = $tasks->getNext();
         //    if ($mode == 'TASK_USER_REQUEST'){
         //       $count_new_accounts ++;
         //    }
         // }
     }
     global $c_jsmath_enable;
     global $c_jsmath_url;
     if (!isset($c_jsmath_enable)) {
         $c_jsmath_enable = false;
     }
     if (!isset($c_jsmath_url)) {
         $c_jsmath_url = '';
     }
     global $c_js_mode;
     global $c_commsy_url_path;
     global $c_commsy_domain;
     $url_path = '';
     if ($c_commsy_url_path != '') {
         $url_path = $c_commsy_url_path . '/';
         if (!(strpos($url_path, '/') === 0)) {
             $url_path = '/' . $c_commsy_url_path;
         }
     } else {
         $url_path = '/';
     }
     $this->assign('basic', 'commsy_path', $c_commsy_domain . $url_path);
     $this->assign('basic', 'tpl_path', $c_commsy_domain . $url_path . $this->_tpl_path);
     $this->assign('environment', 'cid', $this->_environment->getCurrentContextID());
     $this->assign('environment', 'pid', $this->_environment->getCurrentPortalID());
     $this->assign('environment', 'current_user_id', $this->_environment->getCurrentUserID());
     $this->assign('environment', 'function', $this->_environment->getCurrentFunction());
     $this->assign('environment', 'module', $this->_environment->getCurrentModule());
     $this->assign('environment', 'module_name', $translator->getMessage(strtoupper($this->_environment->getCurrentModule())) . '_INDEX');
     $this->assign('environment', 'params', $this->_environment->getCurrentParameterString());
     $this->assign('environment', 'params_array', $this->_environment->getCurrentParameterArray());
     $this->assign('environment', 'username', $current_user->getFullName());
     $this->assign('environment', 'user_item_id', $current_user->getItemID());
     $this->assign('environment', 'user_picture', $current_user->getPicture());
     $this->assign('environment', 'room_type_commnunity', $current_context->isCommunityRoom());
     $this->assign('environment', 'room_type_group', $current_context->isGroupRoom());
     $this->assign('environment', 'is_guest', $current_user->isReallyGuest());
     $this->assign('environment', 'is_read_only', $current_user->isOnlyReadUser());
     $this->assign('environment', 'is_moderator', $current_user->isModerator());
     $this->assign('translation', 'act_month_long', getLongMonthName(date("n") - 1));
     $this->assign('environment', 'lang', $this->_environment->getSelectedLanguage());
     $this->assign('environment', 'logo', $current_context->getLogoFileName());
     $this->assign('environment', 'room_title', $current_context->getTitle());
     $this->assign('environment', 'portal_title', $portal_item->getTitle());
     $this->assign('environment', 'show_room_title', $current_context->showTitle());
     $this->assign('environment', 'language', $current_context->getLanguage());
     $this->assign('environment', 'count_copies', $this->getUtils()->getCopyCount());
     $this->assign('environment', 'show_moderator_link', $current_context->showMail2ModeratorLink());
     $this->assign('environment', 'show_service_link', $portal_item->showServiceLink());
     $this->assign('environment', 'service_link', $this->_getServiceMailLink());
     $this->assign('environment', 'c_jsmath_enable', $c_jsmath_enable);
     $this->assign('environment', 'c_jsmath_url', $c_jsmath_url);
     $this->assign('environment', 'c_js_mode', isset($c_js_mode) && $c_js_mode === "layer" ? $c_js_mode : "source");
     $this->assign('environment', 'count_new_accounts', $count_new_accounts);
     $this->assign('environment', 'post', $_POST);
     $this->assign('environment', 'get', $_GET);
     include_once 'functions/misc_functions.php';
     $this->assign('environment', 'commsy_version', getCommSyVersion());
     $c_version_addon = $this->_environment->getConfiguration('c_version_addon');
     if (!empty($c_version_addon)) {
         $this->assign('environment', 'commsy_version_addon', $c_version_addon);
     }
     // archive
     $this->assign('environment', 'archive_mode', $this->_environment->isArchiveMode());
     // archive
     // browser
     $current_browser = mb_strtolower($this->_environment->getCurrentBrowser(), 'UTF-8');
     $current_browser_version = $this->_environment->getCurrentBrowserVersion();
     $IE8 = false;
     if ($current_browser == 'msie' && strstr($current_browser_version, '8.')) {
         $IE8 = true;
     }
     $this->assign("environment", "IE8", $IE8);
     $ownRoomItem = $current_user->getOwnRoom();
     if ($ownRoomItem) {
         $this->assign("own", "id", $ownRoomItem->getItemId());
         $this->assign("own", "with_activating", $ownRoomItem->withActivatingContent());
     }
     $this->assign('environment', 'use_problems', $this->getUseProblems());
     if (isset($own_room_item) and !$this->_environment->isArchiveMode()) {
         $this->assign('cs_bar', 'show_widgets', $own_room_item->getCSBarShowWidgets());
         $this->assign('cs_bar', 'show_calendar', $own_room_item->getCSBarShowCalendar());
         $this->assign('cs_bar', 'show_stack', $own_room_item->getCSBarShowStack());
         $this->assign('cs_bar', 'show_portfolio', $own_room_item->getCSBarShowPortfolio());
         $this->assign('cs_bar', 'addon_information', $this->getAddonInformation());
         if ($own_room_item->showCSBarConnection()) {
             $this->assign('cs_bar', 'show_connection', $own_room_item->getCSBarShowConnection());
         } else {
             $this->assign('cs_bar', 'show_connection', false);
         }
     } else {
         $this->assign('cs_bar', 'show_widgets', false);
         $this->assign('cs_bar', 'show_calendar', false);
         $this->assign('cs_bar', 'show_stack', false);
         $this->assign('cs_bar', 'show_portfolio', false);
         $this->assign('cs_bar', 'show_connection', false);
     }
     $this->assign('cs_bar', 'show_limesurvey', !($this->_environment->inPortal() || $this->_environment->inServer()) && $current_context->isLimeSurveyActive() && $portal_item->isLimeSurveyActive() && $portal_item->withLimeSurveyFunctions());
     // to javascript
     $to_javascript = array();
     $to_javascript['template']['tpl_path'] = $this->_tpl_path;
     $to_javascript['environment']['lang'] = $this->_environment->getSelectedLanguage();
     $to_javascript['environment']['single_entry_point'] = $this->_environment->getConfiguration('c_single_entry_point');
     $to_javascript['environment']['max_upload_size'] = $this->_environment->getCurrentContextItem()->getMaxUploadSizeInBytes();
     $to_javascript['environment']['portal_link_status'] = $portal_item->getProjectRoomLinkStatus();
     // optional | mandatory
     $to_javascript['environment']['isPortal'] = $this->_environment->getCurrentContextItem()->isPortal();
     // escape ' and replace it with \x27
     $to_javascript['environment']['user_name'] = str_replace("'", '\\x27', $current_user->getFullName());
     $current_portal_user = $this->_environment->getPortalUserItem();
     // password expires soon alert
     if (!empty($current_portal_user) and $current_portal_user->getPasswordExpireDate() > getCurrentDateTimeInMySQL()) {
         $start_date = new DateTime(getCurrentDateTimeInMySQL());
         $since_start = $start_date->diff(new DateTime($current_portal_user->getPasswordExpireDate()));
         $days = $since_start->days;
         if ($days == 0) {
             $days = 1;
         }
         $days_before_expiring_sendmail = $portal_item->getDaysBeforeExpiringPasswordSendMail();
         if (isset($days_before_expiring_sendmail) and $days <= $days_before_expiring_sendmail) {
             $to_javascript["translations"]["password_expire_soon_alert"] = $translator->getMessage("COMMON_PASSWORD_EXPIRE_ALERT", $days);
             $to_javascript['environment']['password_expire_soon'] = true;
         } else {
             if (!isset($days_before_expiring_sendmail) and $days <= 14) {
                 $to_javascript["translations"]["password_expire_soon_alert"] = $translator->getMessage("COMMON_PASSWORD_EXPIRE_ALERT", $days);
                 $to_javascript['environment']['password_expire_soon'] = true;
             }
         }
     } else {
         $to_javascript['environment']['password_expire_soon'] = false;
     }
     // locking
     $checkLocking = $this->_environment->getConfiguration('c_item_locking');
     $checkLocking = $checkLocking ? $checkLocking : false;
     $to_javascript["environment"]["item_locking"] = $checkLocking;
     // single categorie selection
     $singleCatSelection = $this->_environment->getConfiguration('c_single_cat_selection');
     $singleCatSelection = $singleCatSelection ? $singleCatSelection : false;
     $to_javascript["environment"]["single_cat_selection"] = $singleCatSelection;
     $to_javascript['i18n']['COMMON_NEW_BLOCK'] = $translator->getMessage('COMMON_NEW_BLOCK');
     $to_javascript['i18n']['COMMON_SAVE_BUTTON'] = $translator->getMessage('COMMON_SAVE_BUTTON');
     $to_javascript['security']['token'] = getToken();
     $to_javascript['autosave']['mode'] = 0;
     $to_javascript['autosave']['limit'] = 0;
     global $c_media_integration;
     if ($c_media_integration) {
         $to_javascript['c_media_integration'] = true;
         // check for rights for mdo
         $current_context_item = $this->_environment->getCurrentContextItem();
         if ($current_context_item->isProjectRoom()) {
             // does this project room has any community room?
             $community_list = $current_context_item->getCommunityList();
             if ($community_list->isNotEmpty()) {
                 // check for community rooms activated the mdo feature
                 $community = $community_list->getFirst();
                 while ($community) {
                     $mdo_active = $community->getMDOActive();
                     if (!empty($mdo_active) && $mdo_active != '-1') {
                         $to_javascript['mdo_active'] = true;
                         break;
                     }
                     $community = $community_list->getNext();
                 }
             }
         }
     } else {
         $to_javascript['c_media_integration'] = false;
     }
     if ($ownRoomItem) {
         $to_javascript['own']['id'] = $ownRoomItem->getItemId();
         $to_javascript['ownRoom']['id'] = $ownRoomItem->getItemId();
         $to_javascript['ownRoom']['withPortfolio'] = $own_room_item->getCSBarShowPortfolio();
     }
     // translations - should be managed elsewhere soon
     $to_javascript["translations"]["common_hide"] = $translator->getMessage("COMMON_HIDE");
     $to_javascript["translations"]["common_show"] = $translator->getMessage("COMMON_SHOW");
     $current_user = $this->_environment->getCurrentUserItem();
     $auth_source_manager = $this->_environment->getAuthSourceManager();
     $auth_source_item = $auth_source_manager->getItem($current_user->getAuthSource());
     if (isset($auth_source_item)) {
         $show_tooltip = true;
         // password
         if ($auth_source_item->getPasswordLength() > 0) {
             $to_javascript["password"]["length"] = $translator->getMessage('PASSWORD_INFO2_LENGTH', $auth_source_item->getPasswordLength());
         } else {
             $show_tooltip = false;
         }
         if ($auth_source_item->getPasswordSecureBigchar() == 1) {
             $to_javascript["password"]["big"] = $translator->getMessage('PASSWORD_INFO2_BIG');
         } else {
             $show_tooltip = false;
         }
         if ($auth_source_item->getPasswordSecureSmallchar() == 1) {
             $to_javascript["password"]["small"] = $translator->getMessage('PASSWORD_INFO2_SMALL');
         } else {
             $show_tooltip = false;
         }
         if ($auth_source_item->getPasswordSecureNumber() == 1) {
             $to_javascript["password"]["special"] = $translator->getMessage('PASSWORD_INFO2_SPECIAL');
         } else {
             $show_tooltip = false;
         }
         if ($auth_source_item->getPasswordSecureSpecialchar() == 1) {
             $to_javascript["password"]["number"] = $translator->getMessage('PASSWORD_INFO2_NUMBER');
         } else {
             $show_tooltip = false;
         }
     } else {
         $show_tooltip = false;
     }
     if ($show_tooltip) {
         $to_javascript["password"]["tooltip"] = 1;
     } else {
         $to_javascript["password"]["tooltip"] = 0;
     }
     if ($this->_environment->getCurrentFunction() == 'detail' and $this->_environment->getCurrentModule() == 'group') {
         $params = $this->_environment->getCurrentParameterArray();
         $group_manager = $this->_environment->getGroupManager();
         $group_item = $group_manager->getItem($params['iid']);
         if ($group_item->isGroupRoomActivated()) {
             $to_javascript['dev']['room_id'] = $group_item->getGroupRoomItemID();
         }
     }
     // dev
     global $c_indexed_search;
     global $c_xhr_error_reporting;
     $this->assign('environment', 'with_indexed_search', isset($c_indexed_search) && $c_indexed_search === true ? true : false);
     $to_javascript['dev']['indexed_search'] = isset($c_indexed_search) && $c_indexed_search === true ? true : false;
     $to_javascript['dev']['xhr_error_reporting'] = isset($c_xhr_error_reporting) && !empty($c_xhr_error_reporting) ? true : false;
     if (isset($portal_user) && $portal_user->isAutoSaveOn()) {
         global $c_autosave_mode;
         global $c_autosave_limit;
         if (isset($c_autosave_mode) && isset($c_autosave_limit)) {
             $to_javascript['autosave']['mode'] = $c_autosave_mode;
             $to_javascript['autosave']['limit'] = $c_autosave_limit;
         }
     }
     // limesurvey
     if (!($this->_environment->inPortal() || $this->_environment->inServer()) && $current_context->isLimeSurveyActive() && $portal_item->isLimeSurveyActive() && $portal_item->withLimeSurveyFunctions()) {
         $rpcPathParsed = parse_url($portal_item->getLimeSurveyJsonRpcUrl());
         $matches = array();
         preg_match('/(.*)\\/index.php/', $rpcPathParsed['path'], $matches);
         $subPath = '';
         if (isset($matches[1])) {
             $subPath = $matches[1];
         }
         $to_javascript["limesurvey"]["newSurveyPath"] = $rpcPathParsed['scheme'] . "://" . $rpcPathParsed['host'] . $subPath . "/index.php/admin/survey/sa/index";
         $to_javascript["limesurvey"]["adminPath"] = $rpcPathParsed['scheme'] . "://" . $rpcPathParsed['host'] . $subPath . "/index.php/admin/";
         $to_javascript["limesurvey"]["roomName"] = $current_context = $current_context->getTitle();
     }
     // mixin javascript variables
     if (is_array($this->_toJSMixin)) {
         $to_javascript = array_merge($to_javascript, $this->_toJSMixin);
     }
     $this->assign('javascript', 'variables_as_json', json_encode($to_javascript));
     $this->assign("javascript", "locale", $this->_environment->getSelectedLanguage());
     // version
     global $c_debug;
     if (isset($c_debug) && $c_debug === true) {
         $this->assign("javascript", "version", uniqid("", true));
     } else {
         if (file_exists("version")) {
             $versionFromFile = trim(file_get_contents("version"));
             /*
              * It is very important to replace " " whitespaces, otherwhise dojo shows some odd behaviour
              * resulting in adding y11n body classes(high contrast css)
              */
             $this->assign("javascript", "version", str_replace(" ", "_", $versionFromFile));
         } else {
             $this->assign("javascript", "version", "unset");
         }
     }
     // plugins
     $info_before_body_ends = LF . '   <!-- PLUGINS BEGIN -->' . LF;
     include_once 'functions/misc_functions.php';
     $info_before_body_ends .= plugin_hook_output_all('getInfosForBeforeBodyEndAsHTML', array(), LF, false) . LF;
     $info_before_body_ends .= '   <!-- PLUGINS END -->' . LF . LF;
     $this->assign('basic', 'html_before_body_ends', $info_before_body_ends);
 }