Example #1
0
    $page = $pageMgr->getPage($pageID);
    $pageInfo = $page->get();
    $jsQueue = new JSQueue(NULL, $siteID);
}
switch ($action) {
    case 'checkSpecialLinkType':
        $url = $this->params['url'];
        $result = getSpecialURLInfo($url);
        if (!$result) {
            $result = getSpecialURLInfo(createSpecialURLfromShortURL($url));
        }
        echo json_encode($result);
        break;
    case 'checkLinkExternal':
        $url = $this->params['url'];
        $result = checkLinkInternalExternal($url);
        if ($result['TYPE'] == 'external') {
            echo $result['TYPE'];
        } else {
            echo $result['NAME'];
        }
        break;
    case 'savePagePublishingSettings':
        $autopublish_data = json_decode($this->params['autopublishData'], true);
        $changed_field = $this->params['changedField'];
        $version = $this->params['version'];
        $wid = $this->params['wid'];
        if ($version == 'latest') {
            $version = ALWAYS_LATEST_APPROVED_VERSION;
        }
        $old_autopublish_data = $page->scheduler->getSchedule($pageID, 'SCH_AUTOPUBLISH');
Example #2
0
     } else {
         $link_site = $internal[3][0];
         $link_page = str_replace('/', '', $internal[5][0]);
         $pageMgr = new PageMgr($link_site);
         $page = $pageMgr->getPage($link_page);
         $link_pageInfo = $page->get();
         if ($siteID != 'cblock') {
         }
         $tempformfield['LINKTITLE'] = $link_pageInfo['NAME'];
         $tempformfield['IS_INTERNAL'] = true;
     }
 } elseif (substr($props[$c]['VALUE'], 0, 7) == 'mailto:') {
     $tempformfield['IS_EMAIL'] = true;
     $tempformfield['LINKTITLE'] = substr($props[$c]['VALUE'], 7);
 } else {
     $linkInfo = checkLinkInternalExternal($props[$c]['VALUE']);
     switch ($linkInfo['TYPE']) {
         case 'external':
             $tempformfield['LINKTITLE'] = $props[$c]['VALUE'];
             break;
         case 'internal':
             $tempformfield['LINKTITLE'] = $linkInfo['NAME'];
             $tempformfield['IS_INTERNAL'] = true;
             break;
         case 'file':
             $tempformfield['IS_FILE'] = true;
             $tempformfield['LINKTITLE'] = $linkInfo['NAME'];
             $tempformfield['IDENTIFIER'] = $linkInfo['INFO']['IDENTIFIER'];
             $tempformfield['TYPECODE'] = $linkInfo['INFO']['CODE'];
             $tempformfield['COLOR'] = $linkInfo['INFO']['COLOR'];
             $tempformfield['FILE_ID'] = $linkInfo['INFO']['FILE_ID'];
Example #3
0
                     $iconData = getIconForPage($objectInfo);
                     $history[$i]['NEWVALUE'] = '<div class="icon' . $iconData['iconclass'] . '"></div>' . "<a onclick=\"\$K.yg_openObjectDetails('" . $linkinfo[4][0] . '-' . $linkinfo[3][0] . "', 'page', '" . $objectInfo['NAME'] . "', '" . $iconData['iconclass'] . "', '" . $iconData['style'] . "');\">" . $objectInfo['NAME'] . "</a>";
                 }
             }
         } else {
             if ($internal[2][0] == 'image') {
                 $target_type = 'IMAGE';
                 $target_id = $internal[3][0];
             }
         }
     }
 } else {
     if (strpos($history[$i]['NEWVALUE'], 'mailto:') === 0) {
         $history[$i]['NEWVALUE'] = '<div class="iconemail"></div>' . str_replace('mailto:', '', $history[$i]['NEWVALUE']);
     } else {
         $linkInfo = checkLinkInternalExternal($history[$i]['NEWVALUE']);
         switch ($linkInfo['TYPE']) {
             case 'external':
                 $history[$i]['NEWVALUE'] = '<div class="iconlink"></div>' . $history[$i]['NEWVALUE'];
                 break;
             case 'internal':
                 $target_type = 'PAGE';
                 $history[$i]['NEWVALUE'] = '<div class="iconpage"></div>' . $linkInfo['NAME'];
                 break;
             case 'file':
                 $target_type = 'FILE';
                 $history[$i]['NEWVALUE'] = '<span onmouseover="$K.yg_hoverFileHint(\'' . $linkInfo['INFO']['FILE_ID'] . '\', event);"><span style="display:inline-block;" class="filetype ' . $linkInfo['INFO']['COLOR'] . '">' . $linkInfo['INFO']['CODE'] . '</span> ' . "<a onclick=\"\$K.yg_openObjectDetails('" . $linkInfo['INFO']['FILE_ID'] . "', 'file', '" . $linkInfo['NAME'] . "', {color:'" . $linkInfo['INFO']['COLOR'] . "',typecode:'" . $linkInfo['INFO']['CODE'] . "'});\">" . $linkInfo['NAME'] . "</a></span>";
                 break;
         }
     }
 }
Example #4
0
 /**
  * Post processes a property value (resolves urls, permanent names, etc.)
  *
  * @param string $type Property type
  * @param string $value Property value
  * @return mixed Post processed property value
  */
 function postProcessValue($type, $value)
 {
     switch ($type) {
         case 'LINK':
             $linkInfo = checkLinkInternalExternal(resolveSpecialURL($value));
             if ($linkInfo['TYPE'] == 'internal') {
                 return resolveSpecialURL($linkInfoJSON['href']);
             } elseif ($linkInfo['TYPE'] == 'file') {
                 $pname = sFileMgr()->getPNameByFileId($linkInfo['INFO']['FILE_ID']);
                 if ($pname) {
                     return sApp()->webroot . 'download/' . $pname;
                 }
             } else {
                 if ($value != '') {
                     return $value;
                 } else {
                     return NULL;
                 }
             }
         case 'PAGE':
             $pageInfo = json_decode($value, true);
             $tmpPageMgr = sPageMgr($pageInfo['site']);
             $tmpPage = $tmpPageMgr->getPage($pageInfo['page']);
             if ($tmpPage) {
                 $tmpUrl = $tmpPage->getUrl();
                 $tmpPname = $tmpPageMgr->getPNameByPageId($pageInfo['page']);
                 return array('SITE_ID' => $pageInfo['site'], 'PAGE_ID' => $pageInfo['page'], 'URL' => $tmpUrl, 'PNAME' => $tmpPname, 'VALUE' => $value);
             } else {
                 return NULL;
             }
         case 'FILE':
             $pname = sFileMgr()->getPNameByFileId($value);
             if ($pname) {
                 return array('FILE_ID' => $value, 'URL' => sApp()->webroot . 'download/' . $pname, 'IMAGE_URL' => sApp()->webroot . 'image/' . $pname, 'PNAME' => $pname, 'VALUE' => $value);
             } else {
                 return NULL;
             }
         case 'RICHTEXT':
             return replaceSpecialURLs($value);
             break;
         case 'CBLOCK':
             $pname = sCblockMgr()->getPNameByCblockId($value);
             if ($pname) {
                 return array('CBLOCK_ID' => $value, 'PNAME' => $pname, 'VALUE' => $value);
             } else {
                 return NULL;
             }
         case 'TAG':
             $tagInfo = sTags()->get($value);
             if ($tagInfo) {
                 return array('TAG_ID' => $value, 'NAME' => $tagInfo['NAME'], 'VALUE' => $value);
             } else {
                 return NULL;
             }
         default:
             return $value;
     }
 }
Example #5
0
     } else {
         $link_site = $internal[3][0];
         $link_page = str_replace('/', '', $internal[5][0]);
         $pageMgr = new PageMgr($link_site);
         $tmpPage = $pageMgr->getPage($link_page);
         $link_pageInfo = $tmpPage->get();
         if ($siteID != 'cblock') {
         }
         $objectdynprops[$objectdynprops_cnt]['LINKTITLE'] = $link_pageInfo['NAME'];
         $objectdynprops[$objectdynprops_cnt]['IS_INTERNAL'] = true;
     }
 } elseif (substr($objectdynprops[$objectdynprops_cnt]['VALUE'], 0, 7) == 'mailto:') {
     $objectdynprops[$objectdynprops_cnt]['IS_EMAIL'] = true;
     $objectdynprops[$objectdynprops_cnt]['LINKTITLE'] = substr($objectdynprops[$objectdynprops_cnt]['VALUE'], 7);
 } else {
     $linkInfo = checkLinkInternalExternal($objectdynprops[$objectdynprops_cnt]['VALUE']);
     switch ($linkInfo['TYPE']) {
         case 'external':
             $objectdynprops[$objectdynprops_cnt]['LINKTITLE'] = $objectdynprops[$objectdynprops_cnt]['VALUE'];
             break;
         case 'internal':
             $objectdynprops[$objectdynprops_cnt]['LINKTITLE'] = $linkInfo['NAME'];
             $objectdynprops[$objectdynprops_cnt]['IS_INTERNAL'] = true;
             break;
         case 'file':
             $objectdynprops[$objectdynprops_cnt]['IS_FILE'] = true;
             $objectdynprops[$objectdynprops_cnt]['LINKTITLE'] = $linkInfo['NAME'];
             $objectdynprops[$objectdynprops_cnt]['FILEIDENTIFIER'] = $linkInfo['INFO']['IDENTIFIER'];
             $objectdynprops[$objectdynprops_cnt]['FILEABBREVIATION'] = $linkInfo['INFO']['CODE'];
             $objectdynprops[$objectdynprops_cnt]['FILECOLOR'] = $linkInfo['INFO']['COLOR'];
             $objectdynprops[$objectdynprops_cnt]['FILE_ID'] = $linkInfo['INFO']['FILE_ID'];
Example #6
0
 /**
  * Updates References to Images (internal Links)
  *
  * @param int $srcType Source Reference Type
  * @param int $srcObjectId Source Object Id
  * @param int $srcVersion Source Object version
  * @param string $html HTML Code
  */
 private function updateImgHrefFromHtml($srcType, $srcObjectId, $srcVersion, $html)
 {
     $srcType = (int) $srcType;
     $srcObjectId = (int) $srcObjectId;
     $srcVersion = (int) $srcVersion;
     $regexp_img = "<img\\s[^>]*src=(\"??)([^\" >]*?)[^>]*(.*)>";
     if (preg_match_all("/{$regexp_img}/siU", stripslashes($html), $matches, PREG_SET_ORDER) > 0) {
         foreach ($matches as $match) {
             $targetUrl = $match[2];
             $trgtObjectId = "";
             $trgtType = 0;
             $special_url = resolveSpecialURL($targetUrl);
             if ($special_url !== false) {
                 $special_url_info = getSpecialURLInfo($targetUrl);
                 switch ($special_url_info['TYPE']) {
                     case 'DOWN':
                         $trgtType = REFTYPE_FILE;
                         break;
                     case 'IMG':
                         $trgtType = REFTYPE_IMAGE;
                         break;
                     case 'PAGE':
                         $trgtType = REFTYPE_PAGE;
                         break;
                 }
                 $trgtObjectId = $special_url_info['ID'];
                 if ($trgtType != 0) {
                     $this->addRef($srcType, $srcObjectId, $srcVersion, $trgtType, $trgtObjectId);
                 }
             } else {
                 $linkType = checkLinkInternalExternal($targetUrl);
                 $targetUrlArray = explode('/', $targetUrl);
                 switch ($linkType['TYPE']) {
                     case 'internal':
                         $trgtType = REFTYPE_PAGE;
                         $trgtObjectId = $linkType['INFO']['ID'];
                         break;
                     case 'file':
                         if ($targetUrlArray[1] == 'image') {
                             $trgtType = REFTYPE_IMAGE;
                         } else {
                             $trgtType = REFTYPE_FILE;
                         }
                         $trgtObjectId = $linkType['INFO']['FILE_ID'];
                         break;
                 }
                 $this->addRef($srcType, $srcObjectId, $srcVersion, $trgtType, $trgtObjectId);
             }
         }
     }
 }
Example #7
0
     $koala->alert($itext['TXT_CANT_CHANGE_ENTRYMASKTITLE_TO_EMPTY_VALUE']);
     break;
 }
 // Special handling for files
 if ($propertyInfo[0]['TYPE'] == 'FILE') {
     if (substr($value, 0, 7) == '/image/') {
         $realValue = sFileMgr()->getFileIdByPname(substr($value, 7));
         if ($realValue) {
             $value = $realValue;
         }
     }
 }
 // Special handling for links
 if ($propertyInfo[0]['TYPE'] == 'LINK') {
     $value = trim(prettifyUrl($value));
     $result = checkLinkInternalExternal($value);
     if ($result['TYPE'] != 'external') {
         $value = createSpecialURLfromShortURL($value);
     }
 }
 // Special handling for textareas
 if ($propertyInfo[0]['TYPE'] == 'TEXTAREA') {
     $value = str_replace('\\n', "\n", $value);
 }
 // Special handling for wysiwyg
 if ($propertyInfo[0]['TYPE'] == 'RICHTEXT') {
     $value = str_replace('\\n', "\n", $value);
     $value = convertShortURLsToSpecialURLs($value);
 }
 // Set the new property
 if ($entrymaskMgr->setName($data[0], $value) === false) {
Example #8
0
     if ($controlFormfields[$c]['VALUE01'] != $param01) {
         if ($param01 > 0) {
             $history->add($historyType, NULL, NULL, 'TXT_COMMON_H_COEDIT_FRMFLD_4_ON', $data['formfieldid'], $currentContentarea);
         } else {
             $history->add($historyType, NULL, NULL, 'TXT_COMMON_H_COEDIT_FRMFLD_4_OFF', $data['formfieldid'], $currentContentarea);
         }
     }
 }
 // Link
 if ($formfield == 5) {
     // Check if link is an integer (then we only link a file)
     if (is_numeric($param01)) {
         $param01 = trim($this->base . 'download/' . $param01);
     } else {
         $param01 = trim(prettifyUrl($param01));
         $result = checkLinkInternalExternal($param01);
         if ($result['TYPE'] != 'external') {
             $param01 = createSpecialURLfromShortURL($param01);
         }
     }
     $cb->setFormfield($linkid, $param01, $param02, $param03, $param04, $param05, $param06, $param07, $param08);
     $reftracker->updateUrlRef(REFTYPE_FORMFIELD, $linkid, $cbInfo['VERSION'], $param01);
     if ($controlFormfields[$c]['VALUE01'] != $param01) {
         $history->add($historyType, NULL, $param01, 'TXT_COMMON_H_COEDIT_FRMFLD_5', $data['formfieldid'], $currentContentarea);
     }
 }
 // File
 if ($formfield == 6) {
     $cb->setFormfield($linkid, $param01, $param02, $param03, $param04, $param05, $param06, $param07, $param08);
     $reftracker->updateFileRef(REFTYPE_FORMFIELD, $linkid, $cbInfo['VERSION'], $param01);
     if ($controlFormfields[$c]['VALUE01'] != $param01) {
Example #9
0
function getAdditionalFormfieldData(&$controlFormfields)
{
    $entrymaskMgr = new Entrymasks();
    $tagMgr = new Tags();
    $filetypeMgr = new Filetypes();
    for ($w = 0; $w < count($controlFormfields); $w++) {
        $controlFormfields[$w]['LVALUES'] = NULL;
        $controlFormfields[$w]['DISPLAYNAME'] = NULL;
        // Date & Datetime
        if ($controlFormfields[$w]['TYPE'] == 'DATE' || $controlFormfields[$w]['TYPE'] == 'DATETIME') {
            if ($controlFormfields[$w]['VALUE']) {
                $controlFormfields[$w]['VALUE'] = TStoLocalTS($controlFormfields[$w]['VALUE']);
            }
        }
        // Link
        if ($controlFormfields[$w]['TYPE'] == 'LINK') {
            $special_url = resolveSpecialURL($controlFormfields[$w]['URL']);
            if ($special_url !== false) {
                $special_url_info = getSpecialURLInfo($controlFormfields[$w]['VALUE01']);
                if ($special_url_info['TYPE'] == 'IMG' || $special_url_info['TYPE'] == 'DOWN') {
                    $controlFormfields[$w]['IS_FILE'] = true;
                    $file = sFileMgr()->getFile($special_url_info['ID']);
                    $link_fileinfo = $file->get();
                    $controlFormfields[$w]['DISPLAYNAME'] = $link_fileinfo['NAME'];
                    $link_filetype = $filetypeMgr->get($link_fileinfo['FILETYPE']);
                    $controlFormfields[$w]['IDENTIFIER'] = $link_filetype['IDENTIFIER'];
                    $controlFormfields[$w]['TYPECODE'] = $link_filetype['CODE'];
                    $controlFormfields[$w]['COLOR'] = $link_filetype['COLOR'];
                    $controlFormfields[$w]['FILE_ID'] = $special_url_info['ID'];
                } else {
                    $pageMgr = new PageMgr($special_url_info['SITE']);
                    $page = $pageMgr->getPage($special_url_info['ID']);
                    $link_pageInfo = $page->get();
                    $controlFormfields[$w]['DISPLAYNAME'] = $link_pageInfo['NAME'];
                    $controlFormfields[$w]['IS_INTERNAL'] = true;
                }
            } else {
                if (preg_match_all(sApp()->URLRegEx1, $controlFormfields[$w]['VALUE01'], $internal) > 0) {
                    if ($internal[2][0] == 'download') {
                        $controlFormfields[$w]['IS_FILE'] = true;
                        $link_file = str_replace('/', '', $internal[3][0]);
                        $file = sFileMgr()->getFile($link_file);
                        $link_fileinfo = $file->get();
                        $controlFormfields[$w]['DISPLAYNAME'] = $link_fileinfo['NAME'];
                        $link_filetype = $filetypeMgr->get($link_fileinfo['FILETYPE']);
                        $controlFormfields[$w]['IDENTIFIER'] = $link_filetype['IDENTIFIER'];
                        $controlFormfields[$w]['TYPECODE'] = $link_filetype['CODE'];
                        $controlFormfields[$w]['COLOR'] = $link_filetype['COLOR'];
                        $controlFormfields[$w]['FILE_ID'] = $link_file;
                    } else {
                        $link_site = $internal[3][0];
                        $link_page = str_replace('/', '', $internal[5][0]);
                        $pageMgr = new PageMgr($link_site);
                        $page = $pageMgr->getPage($link_page);
                        $link_pageInfo = $page->get();
                        $controlFormfields[$w]['DISPLAYNAME'] = $link_pageInfo['NAME'];
                        $controlFormfields[$w]['IS_INTERNAL'] = true;
                    }
                } elseif (substr($controlFormfields[$w]['URL'], 0, 7) == 'mailto:') {
                    $controlFormfields[$w]['IS_EMAIL'] = true;
                } else {
                    $linkInfo = checkLinkInternalExternal($controlFormfields[$w]['URL']);
                    switch ($linkInfo['TYPE']) {
                        case 'external':
                            $controlFormfields[$w]['DISPLAYNAME'] = $controlFormfields[$w]['URL'];
                            break;
                        case 'internal':
                            $controlFormfields[$w]['DISPLAYNAME'] = $linkInfo['NAME'];
                            $controlFormfields[$w]['IS_INTERNAL'] = true;
                            break;
                        case 'file':
                            $controlFormfields[$w]['IS_FILE'] = true;
                            $controlFormfields[$w]['DISPLAYNAME'] = $linkInfo['NAME'];
                            $controlFormfields[$w]['IDENTIFIER'] = $linkInfo['INFO']['IDENTIFIER'];
                            $controlFormfields[$w]['TYPECODE'] = $linkInfo['INFO']['CODE'];
                            $controlFormfields[$w]['COLOR'] = $linkInfo['INFO']['COLOR'];
                            $controlFormfields[$w]['FILE_ID'] = $linkInfo['INFO']['FILE_ID'];
                            break;
                    }
                }
            }
        }
        // File
        if ($controlFormfields[$w]['TYPE'] == 'FILE') {
            if (trim($controlFormfields[$w]['FILE_ID'])) {
                $file = sFileMgr()->getFile($controlFormfields[$w]['FILE_ID']);
                if ($file) {
                    $fileInfo = $file->get();
                    $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME'];
                    $controlFormfields[$w]['IDENTIFIER'] = $fileInfo['IDENTIFIER'];
                    $controlFormfields[$w]['TYPECODE'] = $fileInfo['CODE'];
                    $controlFormfields[$w]['COLOR'] = $fileInfo['COLOR'];
                }
            }
        }
        // File
        if ($controlFormfields[$w]['TYPE'] == 'FILEFOLDER') {
            if (trim($controlFormfields[$w]['FILE_ID'])) {
                $file = sFileMgr()->getFile($controlFormfields[$w]['FILE_ID']);
                if ($file) {
                    $fileInfo = $file->get();
                    $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME'];
                }
            }
        }
        // Contentblock
        if ($controlFormfields[$w]['TYPE'] == 'CO') {
            if (trim($controlFormfields[$w]['CBLOCK_ID'])) {
                $cb = sCblockMgr()->getCblock($controlFormfields[$w]['CBLOCK_ID']);
                $info = $cb->get();
                $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
            }
        }
        // Tag
        if ($controlFormfields[$w]['TYPE'] == 'TAG') {
            if (trim($controlFormfields[$w]['TAG_ID'])) {
                $info = $tagMgr->get($controlFormfields[$w]['TAG_ID']);
                $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
            }
        }
        // Page
        if ($controlFormfields[$w]['TYPE'] == 'PAGE') {
            if (trim($controlFormfields[$w]['SITE_ID']) && trim($controlFormfields[$w]['PAGE_ID'])) {
                $tmpPageMgr = new PageMgr($controlFormfields[$w]['SITE_ID']);
                $tmpPage = $tmpPageMgr->getPage($controlFormfields[$w]['PAGE_ID']);
                $info = $tmpPage->get();
                $info['RWRITE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $controlFormfields[$w]['PAGE_ID'], "RWRITE");
                $info['RDELETE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $controlFormfields[$w]['PAGE_ID'], "RDELETE");
                $iconData = getIconForPage($info);
                $controlFormfields[$w]['ICON'] = $iconData['iconclass'];
                $controlFormfields[$w]['STYLE'] = $iconData['style'];
                $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
            }
        }
        // List
        if ($controlFormfields[$w]['TYPE'] == 'LIST') {
            if (trim($controlFormfields[$w]['ENTRYMASKFORMFIELD'])) {
                $controlFormfields[$w]['LIST_VALUES'] = $entrymaskMgr->getListValuesByLinkID($controlFormfields[$w]['ENTRYMASKFORMFIELD']);
            }
        }
    }
}