Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * This file contains the backend page for editing meta information of file in upload section.
  4:  *
  5:  * @package          Core
  6:  * @subpackage       Backend
  7:  * @version          SVN Revision $Rev:$
  8:  *
  9:  * @author           Timo Hummel
 10:  * @copyright        four for business AG <www.4fb.de>
 11:  * @license          http://www.contenido.org/license/LIZENZ.txt
 12:  * @link             http://www.4fb.de
 13:  * @link             http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: cInclude('includes', 'functions.upl.php');
 19: 
 20: $isZipFile = isArchive($_REQUEST['file']);
 21: 
 22: $page = new cGuiPage('upl_edit');
 23: 
 24: $page->addStyle('jquery/plugins/timepicker.css');
 25: $page->addScript('jquery/plugins/timepicker.js');
 26: $page->addScript('include.upl_edit.js');
 27: 
 28: //get language js files
 29: if (($lang_short = substr(strtolower($belang), 0, 2)) != 'en') {
 30:     $page->addScript('jquery/plugins/timepicker-' . $lang_short . '.js');
 31:     $page->addScript('jquery/plugins/datepicker-' . $lang_short . '.js');
 32: }
 33: 
 34: $form = new cGuiTableForm('properties');
 35: $form->setVar('frame', $frame);
 36: $form->setVar('area', 'upl');
 37: $form->setVar('path', $_REQUEST['path']);
 38: $form->setVar('file', $_REQUEST['file']);
 39: $form->setVar('action', 'upl_modify_file');
 40: $form->setVar('startpage', $_REQUEST['startpage']);
 41: $form->setVar('sortby', $_REQUEST['sortby']);
 42: $form->setVar('sortmode', $_REQUEST['sortmode']);
 43: $form->setVar('thumbnailmode', $_REQUEST['thumbnailmode']);
 44: // $form->setVar('zip', (isArchive( $_REQUEST['file'])) ? '1' : '0');
 45: $form->addHeader(i18n('Edit'));
 46: 
 47: $properties = new cApiPropertyCollection();
 48: $uploads = new cApiUploadCollection();
 49: 
 50: if (cApiDbfs::isDbfs($_REQUEST['path'])) {
 51:     $qpath = $_REQUEST['path'] . '/';
 52: } else {
 53:     $qpath = $_REQUEST['path'];
 54: }
 55: 
 56: if ((is_writable($cfgClient[$client]['upl']['path'] . $path) || cApiDbfs::isDbfs($path)) && (int) $client > 0) {
 57:     $bDirectoryIsWritable = true;
 58: } else {
 59:     $bDirectoryIsWritable = false;
 60: }
 61: 
 62: $uploads->select("idclient = '" . $client . "' AND dirname = '" . $qpath . "' AND filename='" . $_REQUEST['file'] . "'");
 63: 
 64: if ($upload = $uploads->next()) {
 65: 
 66:     // Which rows to display?
 67:     $aListRows = array();
 68:     $aListRows['filename'] = i18n('File name');
 69:     $aListRows['path'] = i18n('Path');
 70:     $aListRows['replacefile'] = i18n('Replace file');
 71:     $aListRows['medianame'] = i18n('Media name');
 72:     $aListRows['description'] = i18n('Description');
 73:     $aListRows['keywords'] = i18n('Keywords');
 74:     $aListRows['medianotes'] = i18n('Internal notes');
 75:     $aListRows['copyright'] = i18n('Copyright');
 76:     $aListRows['protected'] = i18n('Protection');
 77:     $aListRows['timecontrol'] = i18n('Time control');
 78:     $aListRows['preview'] = i18n('Preview');
 79:     $aListRows['author'] = i18n('Author');
 80:     $aListRows['modified'] = i18n('Last modified by');
 81: 
 82:     if ($isZipFile) {
 83:         $id = $_GET['user_id'];
 84:         //echo '<input type="button" value="test";
 85: 
 86:         if (isset($_SESSION['zip']) && $_SESSION['zip'] === 'extract') {
 87: 
 88:         }
 89: 
 90:         $link = new cHTMLLink();
 91:         $link->appendContent(i18n('extract'));
 92:         $aListRows['zip'] = $link;
 93:     }
 94:     ($isZipFile) ? $aListRows['extractFolder'] = '<label class="ZipExtract">' . i18n('extractTo') . '</label>' : '';
 95: 
 96:     // Delete dbfs specific rows
 97:     if (!cApiDbfs::isDbfs($_REQUEST['path'])) {
 98:         unset($aListRows['protected']);
 99:         unset($aListRows['timecontrol']);
100:     }
101: 
102:     // Call chains to process the rows
103:     $_cecIterator = $_cecRegistry->getIterator('Contenido.Upl_edit.Rows');
104:     if ($_cecIterator->count() > 0) {
105:         while ($chainEntry = $_cecIterator->next()) {
106:             $newRowList = $chainEntry->execute($aListRows);
107:             if (is_array($newRowList)) {
108:                 $aListRows = $newRowList;
109:             }
110:         }
111:     }
112: 
113:     $iIdupl = $upload->get('idupl');
114: 
115:     $uploadMeta = new cApiUploadMeta();
116:     $uploadMeta->loadByUploadIdAndLanguageId($iIdupl, $lang);
117: 
118:     // Add rows to $form
119:     foreach ($aListRows as $sListRow => $sTitle) {
120:         $sCell = '';
121:         switch ($sListRow) {
122:             case 'filename':
123:                 $sCell = $_REQUEST['file'];
124:                 break;
125: 
126:             case 'zip':
127:                 $sCell = new cHTMLCheckbox('extractZip', '');
128:                 $sCell->setEvent('onclick', 'show();');
129:                 // $sCell->setClass('ZipExtract');
130:                 break;
131: 
132:             case 'extractFolder':
133:                 $box = new cHTMLTextbox('efolder');
134:                 $box->setID('extractFolder');
135:                 $box->setValue(strstr($_REQUEST['file'], '.', TRUE));
136:                 $box->setClass('ZipExtract');
137:                 $sCell = $box;
138:                 $checkbox = new cHTMLCheckbox('overwrite', i18n('overwrite'));
139:                 $checkbox->setID('overwrite');
140:                 $checkbox->setLabelText(i18n('overwrite'));
141:                 $checkbox->setClass('ZipExtract');
142: 
143:                 $sCell .= $checkbox;
144:                 break;
145: 
146:             case 'path':
147:                 $sCell = generateDisplayFilePath($qpath, 65);
148:                 break;
149: 
150:             case 'replacefile':
151:                 $uplelement = new cHTMLUpload('file', 40);
152:                 $uplelement->setDisabled(!$bDirectoryIsWritable);
153:                 $sCell = $uplelement->render();
154:                 break;
155: 
156:             case 'medianame':
157:                 if ($uploadMeta->get('medianame')) {
158:                     $medianame = cSecurity::unFilter($uploadMeta->get('medianame'));
159:                 } else {
160:                     $medianame = $properties->getValue('upload', $qpath . $_REQUEST['file'], 'file', 'medianame');
161:                 }
162: 
163:                 $mnedit = new cHTMLTextbox('medianame', $medianame, 60);
164:                 $sCell = $mnedit->render();
165:                 break;
166: 
167:             case 'description':
168:                 if ($uploadMeta->get('description')) {
169:                     $description = cSecurity::unFilter($uploadMeta->get('description'));
170:                 } else {
171:                     $description = '';
172:                 }
173: 
174:                 $dsedit = new cHTMLTextarea('description', $description);
175:                 $sCell = $dsedit->render();
176:                 break;
177: 
178:             case 'keywords':
179:                 if ($uploadMeta->get('keywords')) {
180:                     $keywords = cSecurity::unFilter($uploadMeta->get('keywords'));
181:                 } else {
182:                     $keywords = $properties->getValue('upload', $qpath . $_REQUEST['file'], 'file', 'keywords');
183:                 }
184: 
185:                 $kwedit = new cHTMLTextarea('keywords', $keywords);
186:                 $sCell = $kwedit->render();
187:                 break;
188: 
189:             case 'medianotes':
190:                 if ($uploadMeta->get('internal_notice')) {
191:                     $medianotes = cSecurity::unFilter($uploadMeta->get('internal_notice'));
192:                 } else {
193:                     $medianotes = $properties->getValue('upload', $qpath . $_REQUEST['file'], 'file', 'medianotes');
194:                 }
195: 
196:                 $moedit = new cHTMLTextarea('medianotes', $medianotes);
197:                 $sCell = $moedit->render();
198:                 break;
199: 
200:             case 'copyright':
201:                 if ($uploadMeta->get('copyright')) {
202:                     $copyright = cSecurity::unFilter($uploadMeta->get('copyright'));
203:                 } else {
204:                     $copyright = $properties->getValue('upload', $qpath . $_REQUEST['file'], 'file', 'copyright');
205:                 }
206: 
207:                 $copyrightEdit = new cHTMLTextarea('copyright', $copyright);
208:                 $sCell = $copyrightEdit->render();
209:                 break;
210: 
211:             case 'protected':
212:                 $vprotected = $properties->getValue('upload', $qpath . $_REQUEST['file'], 'file', 'protected');
213:                 $protected = new cHTMLCheckbox('protected', '1');
214:                 $protected->setChecked($vprotected);
215:                 $protected->setLabelText(i18n('Protected for non-logged in users'));
216:                 $sCell = $protected->render();
217:                 break;
218: 
219:             case 'timecontrol':
220:                 $iTimeMng = (int) $properties->getValue('upload', $qpath . $_REQUEST['file'], 'file', 'timemgmt');
221:                 $sStartDate = $properties->getValue('upload', $qpath . $_REQUEST['file'], 'file', 'datestart');
222:                 $sEndDate = $properties->getValue('upload', $qpath . $_REQUEST['file'], 'file', 'dateend');
223: 
224:                 $oTimeCheckbox = new cHTMLCheckbox('timemgmt', i18n('Use time control'));
225:                 $oTimeCheckbox->setChecked($iTimeMng);
226: 
227:                 $sHtmlTimeMng = $oTimeCheckbox->render();
228:                 $sHtmlTimeMng .= "<table id='dbfsTimecontrol' class='borderless' border='0' cellpadding='0' cellspacing='0'>\n";
229:                 $sHtmlTimeMng .= "<tr><td><label for='datestart'>" . i18n('Start date') . "</label></td>\n";
230:                 $sHtmlTimeMng .= '<td><input type="text" name="datestart" id="datestart" value="' . $sStartDate . '"  size="20" maxlength="40" class="text_medium">' .
231:                         '</td></tr>';
232:                 $sHtmlTimeMng .= "<tr><td><label for='dateend'>" . i18n('End date') . "</label></td>\n";
233:                 $sHtmlTimeMng .= '<td><input type="text" name="dateend" id="dateend" value="' . $sEndDate . '"  size="20" maxlength="40" class="text_medium">' .
234:                         '</td></tr>';
235:                 $sHtmlTimeMng .= "</table>\n";
236: 
237:                 $sCell = $sHtmlTimeMng;
238:                 break;
239: 
240:             case 'preview':
241:                 if (cApiDbfs::isDbfs($_REQUEST['path'])) {
242:                     $sCell = '<a target="_blank" href="' . $sess->url(cRegistry::getFrontendUrl() . "dbfs.php?file=" . $qpath . $_REQUEST['file']) . '"><img alt="" class="bordered" src="' . uplGetThumbnail($qpath . $_REQUEST['file'], 350) . '"></a>';
243:                 } else {
244:                     $sCell = '<a target="_blank" href="' . $cfgClient[$client]['upl']['htmlpath'] . $qpath . $_REQUEST['file'] . '"><img alt="" class="bordered" src="' . uplGetThumbnail($qpath . $_REQUEST['file'], 350) . '"></a>';
245:                 }
246:                 break;
247: 
248:             case 'author':
249:                 $oUser = new cApiUser($upload->get('author'));
250:                 $sCell = $oUser->get('username') . ' (' . displayDatetime($upload->get('created')) . ')';
251:                 break;
252: 
253:             case 'modified':
254:                 $oUser = new cApiUser($upload->get('modifiedby'));
255:                 $sCell = $oUser->get('username') . ' (' . displayDatetime($upload->get('lastmodified')) . ')';
256:                 break;
257: 
258:             default:
259:                 // Call chain to retrieve value
260:                 $_cecIterator = $_cecRegistry->getIterator('Contenido.Upl_edit.RenderRows');
261: 
262:                 if ($_cecIterator->count() > 0) {
263:                     $contents = array();
264:                     while ($chainEntry = $_cecIterator->next()) {
265:                         $contents[] = $chainEntry->execute($iIdupl, $qpath, $_REQUEST['file'], $sListRow);
266:                     }
267:                 }
268:                 $sCell = implode('', $contents);
269:         }
270:         $form->add($sTitle, $sCell);
271:     }
272: 
273:     if ($bDirectoryIsWritable == false) {
274:         $pager->displayError(i18n('Directory not writable') . ' (' . $cfgClient[$client]['upl']['path'] . $path . ')');
275:     }
276: 
277:     $page->set('s', 'FORM', $form->render());
278: } else {
279:     $page->displayCriticalError(sprintf(i18n('Could not load file %s'), $_REQUEST['file']));
280: }
281: 
282: $page->render();
283: 
284: function isArchive($fileName) {
285: 
286:     if (substr(strrchr($fileName, '.'), 1) === 'zip') {
287:         return true;
288:     } else {
289:         return false;
290:     }
291: }
292: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen