function showFlashComponent($id) { $database =& JFactory::getDBO(); $row = new joomla_flash_uploader($database); $row->load($id); if (!$row->resize_show) { // no profile found or no id! HTML_joomla_flash_uploader::wrongId($id); } else { $uploadfolder = $row->folder; $user =& JFactory::getUser(); // we check if we have a master profile! if ($row->master_profile == 'true') { if ($user->id != 0) { if ($row->master_profile_mode == 'id') { $uploadfolder = $uploadfolder . '/' . $user->id; } else { if ($row->master_profile_lowercase == 'true') { $uploadfolder = $uploadfolder . '/' . strtolower($user->username); } else { $uploadfolder = $uploadfolder . '/' . $user->username; } } // we check if the folder exists - if not it is created! if (!file_exists($uploadfolder) && $uploadfolder != "") { mkdir($uploadfolder); // if the copy directory exists we copy everything! $extra_dir = "components/com_joomla_flash_uploader/default"; if (file_exists($extra_dir)) { JFUHelper::dir_copy($extra_dir, $uploadfolder); } } } else { HTML_joomla_flash_uploader::noUser($id); return; } } // we go back to the main folder! path has to be relativ to the tfu upload folder! if ($uploadfolder == "") { $folder = "./../../../.."; } else { $folder = "./../../../../" . $uploadfolder; } JFUHelper::setJFUSession($row, $folder); $_SESSION["TFU_FILE_CHMOD"] = JFUHelper::getVariable($database, 'file_chmod'); $_SESSION["TFU_DIR_CHMOD"] = JFUHelper::getVariable($database, 'dir_chmod'); unset($_SESSION["IS_ADMIN"]); $_SESSION["IS_FRONTEND"] = "TRUE"; if ($user->id != 0) { $_SESSION["TFU_USER"] = $user->username; $_SESSION["TFU_USER_ID"] = $user->id; } else { unset($_SESSION["TFU_USER"]); unset($_SESSION["TFU_USER_ID"]); } // we check if the flash should be included with js oder the object tag $use_js_include = JFUHelper::check_js_include($database); store_temp_session(); JFUHelper::fixSession(); HTML_joomla_flash_uploader::showFlash($row, $uploadfolder, $use_js_include, false); } }
function listConfig($rows, $jfu_config) { $count = count($rows) + 1; // because id starts at 1 $config = new JConfig(); $vers = $jfu_config['version']; // we build the version string! $latest_version = JFUHelper::getlatestVersion(); $version_description = $latest_version; if ($latest_version == -1) { $version_description = '<span class="jfu_nocheck">' . JText::_('C_VERSION_NO') . ' <a href="http://jfu.tinywebgallery.com" target="_blank">http://jfu.tinywebgallery.com</a> ' . JText::_('C_VERSION_NO2') . '</span>'; } else { if ($latest_version != $vers) { $version_description = '<span class="jfu_old">' . JText::_('C_VERSION_OLD1') . ' <a href="http://jfu.tinywebgallery.com" target="_blank">http://jfu.tinywebgallery.com</a> ' . JText::_('C_VERSION_OLD2') . JText::_('C_VERSION_OLD3') . ' <b>' . $latest_version . '</b>. ' . JText::_('C_VERSION_OLD4') . ' <b>' . $vers . '.</b><p> ' . JText::_('C_VERSION_OLD5') . ' <a href="http://blog.tinywebgallery.com" target="_blank">' . JText::_('C_VERSION_OLD6') . '</a>.' . '</p></span>'; } else { $version_description = '<span class="jfu_current">' . JText::_('C_VERSION_OK') . '</span>'; } } echo ' <script type="text/javascript" src="components/com_joomla_flash_uploader/jfu.js"></script> <form action="index2.php" method="post" name="adminForm"> <h2>' . JText::_('C_TITLE') . '</h2> ' . JText::_('C_TEXT') . ' <h3 style="text-align:left;">' . JText::_('E_H3_PROFILES') . '</h3> <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist" > <thead> <tr> <th width="20"> <input type="checkbox" name="toggle" value="" onclick="checkAll(' . $count . ');"/> </th> <th align="left" width="2%">' . JText::_('C_ID') . '</th> <th align="left" width="40">' . JText::_('C_GROUP') . '</th> <th align="left" width="10%">' . JText::_('C_PROFILE') . '</th> <th align="left" width="20%">' . JText::_('C_DESCRIPTION') . '</th> <th align="left" width="15%">' . JText::_('C_FOLDER') . '</th> <th align="left" width="10%">' . JText::_('C_UPLOAD_LIMIT') . '</th> <th align="left" width="20%">' . JText::_('C_USERS') . '</th> <th align="left" width="5%">' . JText::_('C_MASTER_PROFILE') . '</th> <th width="5%">' . JText::_('C_ENABLED') . '</th> <th width="10%">' . JText::_('C_DATE') . '</th> </tr> </thead> '; $i = 0; foreach ($rows as $row) { $evenodd = $i % 2; if ($row->maxfilesize == "") { $row->maxfilesize = JText::_('C_AUTO') . getMaximumUploadSize(); } echo <<<HTML <tr class="row{$evenodd}"> <td> <input type="checkbox" id="cb{$row->id}" name="cid[]" value="{$row->id}" onclick="isChecked(this.checked);" /> </td> <td> <a href="#edit" onclick="return listItemTask('cb{$row->id}','edit')"> {$row->id}</a> </td> <td>{$row->gid} </td> <td> \t\t\t\t <a href="#edit" \t\t\t\t onclick="return listItemTask('cb{$row->id}','edit')"> \t\t\t\t {$row->config_name}</a> </td> <td>{$row->description} </td> <td>{$row->folder} </td> <td>{$row->maxfilesize} KB</td> <td>{$row->resize_label}</td> HTML; // master echo "<td align='center'>"; if ($row->id != 1) { echo "<span style='cursor:pointer;' id='enableM" . $row->id . "'>"; if ($row->master_profile == "true") { echo "<img onClick='disableMaster(" . $row->id . ")' src='images/tick.png' border='0' />"; } else { echo "<img onClick='enableMaster(" . $row->id . ")' src='images/publish_x.png' border='0' />"; } } else { echo ' '; } echo "</span>"; echo "</td>"; // enable echo "<td align='center'>"; echo "<span style='cursor:pointer;' id='enableP" . $row->id . "'>"; if ($row->enable_setting == "true") { echo "<img onClick='disableProfile(" . $row->id . ")' src='images/tick.png' border='0' />"; } else { echo "<img onClick='enableProfile(" . $row->id . ")' src='images/publish_x.png' border='0' />"; } echo "</span>"; echo "</td>"; echo "<td align='center'>" . $row->last_modified_date . "</td></tr>"; $i++; } echo "</table><br>"; echo ' <h3 style="text-align:left;">' . JText::_('E_H3_GLOB') . '</h3> <table class="admintable"> <thead> <tr> <th width="20%">' . JText::_('E_H_SETTING') . '</th> <th width="20%">' . JText::_('E_H_VALUE') . '</th> <th width="60%">' . JText::_('E_H_DESCRIPTION') . '</th> </tr> </thead> <tbody> <tr> <td class="key">' . JText::_('E_S_JFU_VERSION') . '</td> <td>' . $vers . '</td> <td>' . $version_description . '</td> </tr> <tr> <td class="key">' . JText::_('E_S_JFU_SESSION') . '</td> <td>' . $config->session_handler . ($config->session_handler == 'database' ? " <img src='../includes/js/ThemeOffice/warning.png' style='vertical-align:middle;width:16px' />" : " <img src='images/tick.png' style='vertical-align:middle;' />") . '</td> <td>' . ($config->session_handler == 'database' ? '<span class="jfu_nocheck">' . JText::_('E_D_JFU_SESSION_DB') . '</span>' : JText::_('E_D_JFU_SESSION_NONE')) . '</td> </tr> <tr> <td class="key">' . JText::_('E_S_JFU_KEEP') . '</td> <td>' . tfuHTML::truefalseRadioList('keep_tables', 'class="inputbox"', $jfu_config['keep_tables']) . '</td> <td>' . JText::_('E_D_JFU_KEEP') . '</td> </tr> <tr> <td class="key">' . JText::_('E_S_JFU_USE_JS_INCLUDE') . '</td> <td>' . tfuHTML::truefalseRadioList('use_js_include', 'class="inputbox"', $jfu_config['use_js_include']) . '</td> <td>' . JText::_('E_D_JFU_USE_JS_INCLUDE') . '</td> </tr> <tr> <td class="key">' . JText::_('E_S_JFU_BACKEND_ACCESS_UPLOAD') . '</td> <td>' . tfuHTML::showAdminSelectBox('backend_access_upload', 'class="inputbox"', $jfu_config['backend_access_upload']) . '</td> <td>' . JText::_('E_D_JFU_BACKEND_ACCESS_UPLOAD') . '</td> </tr> <tr> <td class="key">' . JText::_('E_S_JFU_BACKEND_ACCESS_CONFIG') . '</td> <td>' . tfuHTML::showAdminSelectBox('backend_access_config', 'class="inputbox"', $jfu_config['backend_access_config']) . '</td> <td>' . JText::_('E_D_JFU_BACKEND_ACCESS_CONFIG') . '</td> </tr> <tr> <td class="key">' . JText::_('E_S_JFU_FILE_CHMOD') . '</td> <td><input type="text" class="w50" maxsize="100" name="file_chmod" value="' . $jfu_config['$file_chmod'] . '" /></td> <td>' . JText::_('E_D_JFU_FILE_CHMOD') . '</td> </tr> <tr> <td class="key">' . JText::_('E_S_JFU_DIR_CHMOD') . '</td> <td><input type="text" class="w50" maxsize="100" name="dir_chmod" value="' . $jfu_config['dir_chmod'] . '" /></td> <td>' . JText::_('E_D_JFU_DIR_CHMOD') . '</td> </tr> </tbody> </table> '; echo <<<HTML <input type="hidden" name="task" value="" /> <input type="hidden" name="option" value="com_joomla_flash_uploader"/> <input type="hidden" name="boxchecked" value="0" /> </form> HTML; }
function _CONFIG() { $canDo = JFUHelper::getActions(); JToolBarHelper::title('JFUploader', 'jfu_toolbar_title'); if ($canDo->get('core.manage')) { JToolBarHelper::custom('upload', 'upload', 'upload', T_UPLOAD, false); JToolBarHelper::divider(); } if ($canDo->get('core.edit.state') && $canDo->get('core.admin')) { JToolBarHelper::custom('user', 'user', 'user', T_USER, false); JToolBarHelper::divider(); } if ($canDo->get('core.admin')) { JToolBarHelper::custom('plugins', 'plugins', 'plugins', T_PLUGINS, false); JToolBarHelper::divider(); } if ($canDo->get('core.admin')) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('newConfig'); } if ($canDo->get('core.edit')) { JToolBarHelper::editList('edit'); } if ($canDo->get('core.create')) { JToolBarHelper::custom('copyConfig', 'copy', 'copy', T_COPY, false); } if ($canDo->get('core.manage')) { JToolBarHelper::save('saveMainConfig'); } if ($canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'deleteConfig'); } } JToolBarHelper::divider(); if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_jfuploader', '550', '850', JACTION_ADMIN_JFU_PERMISSIONS); JToolBarHelper::divider(); } JToolBarHelper::help('tfu', true); }
function dir_copy($source, $target) { if (is_dir($source)) { @mkdir($target); $d = dir($source); while (FALSE !== ($entry = $d->read())) { if ($entry == '.' || $entry == '..') { continue; } $Entry = $source . '/' . $entry; if (is_dir($Entry)) { JFUHelper::dir_copy($Entry, $target . '/' . $entry); continue; } copy($Entry, $target . '/' . $entry); } $d->close(); } else { copy($source, $target); } }
function getAvailableGroups($id) { // get the group of this profile $db = JFactory::getDBO(); $query = 'select gid from #__joomla_flash_uploader where id=' . $id; $db->setQuery($query); $options = $db->loadObjectList(); $group_id = $options[0]->gid; // select the joomla groups that are assigned to a different jfu group $db->setQuery('select jgroup from #__joomla_flash_uploader_user where location=\'site\' and profile in (SELECT id FROM #__joomla_flash_uploader where id <> ' . $id . ' and jgroup IS NOT NULL and gid = \'' . $group_id . '\')'); $jgroups = $db->loadObjectList(); if (count($jgroups) > 0) { $assigned_groups = array(); foreach ($jgroups as $jg) { $assigned_groups[] = $jg->jgroup; } $filter = "a.id NOT in (" . implode(",", $assigned_groups) . ")"; } else { $filter = ' 1=1 '; } $av_groups = JFUHelper::getUserGroups($filter); // echo '<br>'print_r(mixed expression, [bool return])print_r($av_groups); // select the ones which are assigned to this jfu group to mark them $db->setQuery('select jgroup from #__joomla_flash_uploader_user where location=\'site\' and profile in (SELECT id FROM #__joomla_flash_uploader where id = ' . $id . ' and gid = \'' . $group_id . '\')'); $jgroups_res = $db->loadObjectList(); $jgroups = array(); // extract the hits foreach ($jgroups_res as $key => $value) { $jgroups[] = $value->jgroup; } // set the hits in the available joomla groups foreach ($av_groups as $av_group) { if (in_array($av_group->value, $jgroups)) { $av_group->jselected = 'true'; } else { $av_group->jselected = 'false'; } } return $av_groups; }
function showHelpRegister() { global $m, $mybasedir; $canDo = JFUHelper::getActions(); $language = JFactory::getLanguage(); $lang = $language->getTag() == 'de-DE' ? 'de_DE' : 'en_US'; echo ' <style> .install { margin-left: 5px; margin-right: 5px; margin-top: 10px; margin-bottom: 10px; padding: 10px; text-align:left; border: 1px solid #cccccc; width:720px; background: #F1F1F1; } .h3_help { text-align:left; border-bottom: 2px solid #DDDDDD; } </style> <form action="index.php" method="post" name="adminForm" id="adminForm"> <h2>' . JText::_('H_TITLE') . '</h2> <!-- Facebook like button --> <p> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/' . $lang . '/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script> <div class="fb-like-box" data-href="http://www.facebook.com/tinywebgallery" data-width="700" data-border-color="white" data-show-faces="false" data-stream="true" data-header="false"></div> </p> <!-- end Facebook like button --> <h3 class="h3_help">' . JText::_('H_H3_HELP') . '</h3> ' . JText::_('H_H_TEXT') . ' <div style="text-align:left;float:left;"> <ul> <li>' . JText::_('H_H_OVERVIEW') . '</li> <li>' . JText::_('H_H_HELP') . '</li> <li>' . JText::_('H_H_TWG') . '</li> <li>' . JText::_('H_H_FORUM') . '</li> <li>' . JText::_('H_H_CONFIG') . '</li> <li>' . JText::_('H_H_MAMBOT') . '</li> <li>' . JText::_('H_H_REG') . '</li> </ul> </div> <h3 class="h3_help">' . JText::_('H_L_TITLE') . '</h3> <div style="text-align:left;float:left;"> ' . JText::_('H_L_TEXT') . ' <div class="install" style="width:600px;margin-left:50px;"> <b>' . JText::_('H_L_INFOS') . '</b><p> '; $limit = return_kbytes(ini_get('memory_limit')); echo JText::_('H_L_NAME') . " " . $_SERVER['SERVER_NAME'] . "<br>"; echo JText::_('H_L_LIMIT') . " " . getMaximumUploadSize() . "<br>"; echo JText::_('H_L_MEMORY') . " " . $limit . " <br>"; echo JText::_('H_L_RESOLUTION') . " "; if (!$limit) { echo '<font color="green">No limit</font>'; } else { $xy = $limit * 1024 / 6.6; $x = floor(sqrt($xy / 0.75)); $y = floor(sqrt($xy / 1.33)); if ($x > 4000) { echo "<font color='green'>~ " . $x . " x " . $y . "</font>"; } else { if ($x > 2000) { echo "<font color='orange'>~ " . $x . " x " . $y . "</font>"; } else { echo "<font color='red'>~ " . $x . " x " . $y . "</font>"; } } } echo "<br>"; echo JText::_('H_L_INPUT') . " " . ini_get('max_input_time') . " s<br>"; echo JText::_('H_L_EXECUT') . " " . ini_get('max_execution_time') . " s<br>"; echo JText::_('H_L_SOCKET') . " " . ini_get('default_socket_timeout') . " s"; if ($canDo->get('core.admin')) { if (substr(@php_uname(), 0, 7) != "Windows") { echo '<p>' . JText::_('H_L_CHMOD1') . ' ' . substr(sprintf('%o', @fileperms(dirname(__FILE__) . "/tfu/tfu_config.php")), -4); echo '<br>' . JText::_('H_L_CHMOD2'); echo '</p><p> <button onclick="this.form.task.value=\'chmod755\';this.form.submit();">' . JText::_('H_L_CHMOD755') . '</button> <button onclick="this.form.task.value=\'chmod644\';this.form.submit();">' . JText::_('H_L_CHMOD644') . '</button> <button onclick="this.form.task.value=\'chmod666\';this.form.submit();">' . JText::_('H_L_CHMOD666') . '</button> <button onclick="this.form.task.value=\'chmod777\';this.form.submit();">' . JText::_('H_L_CHMOD777') . '</button> </p> '; } } else { echo '<p>' . JText::_('ACL_MANAGE_NEEDED') . '</p>'; } echo ' </p> </div> </div> <h3 class="h3_help">' . JText::_('H_R_TITLE') . '</h3>'; if ($canDo->get('core.admin')) { echo ' <div style="text-align:left;float:left;"> '; if ($m == "") { echo JText::_('H_R_TEXT') . '<ul> <li>' . JText::_('H_R_FREEWARE') . '</li <li>' . JText::_('H_R_REG') . '</li></ul> <div class="install" style="width:600px;margin-left:50px;">' . JText::_('H_R_BONUS') . '</div>'; printf(JText::_('H_R_REG_10'), "<a href=\"http://www.tinywebgallery.com/en/register_tfu.php\"><b>", "</b></a>"); echo '<p>' . JText::_('H_R_REG_HOWTO') . '</p> <div class="install" style="width:600px;margin-left:50px;"> <?php <table><tr><td> $l</td><td>=" <input type="text" name="l" size=100> ";</td></tr><tr><td> $d</td><td>=" <input type="text" name="d" size=100> ";</td></tr><tr><td> $s</td><td>=" <input type="text" name="s" size=100> ";</td></tr></table> ?> <p> <input type="hidden" name="task" value="register" /> <button onclick="this.form.submit();">' . JText::_('H_R_REGISTER') . '</button> </p> </div> '; } else { if ($m != "" && $m != "s" && $m != "w") { include dirname(__FILE__) . '/' . $mybasedir . "tfu/twg.lic.php"; echo JText::_('H_R_REG_TO') . " <b>{$l}</b>"; if ($l == $d) { echo " (Enterprise Edition License)"; } else { if (strpos($d, "TWG_PROFESSIONAL") !== false) { echo " (Professional Edition License)"; } else { if (strpos($d, "TWG_SOURCE") !== false) { echo " (Source code Edition License)"; } else { echo " (Standart Edition License)"; } } } echo "<p>" . JText::_('H_R_REG_DEL'); echo ' <input type="hidden" name="task" value="dellic" /> <button onclick="this.form.submit();">' . JText::_('H_R_UNREGISTER') . '</button> </p>'; } else { echo "<p>" . JText::_('H_R_REG_WRONG'); echo ' <input type="hidden" name="task" value="dellic" /> <button onclick="this.form.submit();">' . JText::_('H_R_UNREGISTER') . '</button> </p>'; } } echo <<<HTML </div> \t <input type="hidden" name="option" value="com_jfuploader"/> \t <input type="hidden" name="boxchecked" value="0" /> HTML; } else { echo JText::_('ACL_MANAGE_NEEDED'); } echo ' <div style="clear:both;"></div> <h3 class="h3_help">' . JText::_('E_LOG_HEADER') . '</h3>'; if ($canDo->get('core.admin')) { echo ' <div style="text-align:left;float:left;"> ' . JText::_('E_LOG_INTRO') . ' </div> <div style="clear:both;"></div> <p> <div class="logcontainer">'; $debugfile = dirname(__FILE__) . '/' . $mybasedir . "tfu/tfu.log"; if (file_exists($debugfile)) { $data = file_get_contents($debugfile); echo str_replace("\n", '<br>', $data); } else { echo 'No debug found'; } echo ' </div> </p> <p> <br> <a class="jfu_button" href="#deletelog" onclick="return submitform(\'deletelog\')"> ' . JText::_('E_LOG_BUTTON') . ' </a> <p>'; } else { echo JText::_('ACL_MANAGE_NEEDED'); } echo ' </form> '; }
function showFlashPlugin($id, $twgpath) { global $prefix_path; $database = JFactory::getDBO(); $row = new joomla_flash_uploader($database); $row->load($id); if (!$row->resize_show) { // no profile found or no id! return HTML_joomla_flash_uploader::wrongId($id, true); } else { $uploadfolder = $row->folder; $uploadfolder_base = $uploadfolder; $user = JFactory::getUser(); // we check if we have a master profile! if ($row->master_profile == 'true') { if ($user->id != 0 || $row->master_profile_mode == 'ip') { if ($row->master_profile_mode == 'id') { $_SESSION["s_user"] = $user->id; $uploadfolder = $uploadfolder . '/' . $user->id; } else if ($row->master_profile_mode == 'ip') { $uploadfolder = $uploadfolder . '/' . $_SERVER['REMOTE_ADDR']; } else if ($row->master_profile_mode == 'group') { $group = JFUHelper::getHighestGroupName($database, $user->groups); if ($row->master_profile_lowercase == 'true') { $normalizeSpaces=true; $group = normalizeFileNames($group); } $uploadfolder = $uploadfolder . '/' . $group; } else { if ($row->master_profile_mode == 'login') { $uname = $user->username; } else { $uname = $user->name; } $_SESSION["s_user"] = $uname; if ($row->master_profile_lowercase == 'true') { $normalizeSpaces=true; $uname = normalizeFileNames($uname); } $uploadfolder = $uploadfolder . '/' . $uname; } // we check if the folder exists - if not it is created! if (!file_exists($uploadfolder) && $uploadfolder != "") { $dir_chmod = JFUHelper::getVariable($database, 'dir_chmod'); $ftp_enable = $row->ftp_enable; if (isset($ftp_enable) && $ftp_enable == 'true') { $ftp_host = $row->ftp_host; $ftp_port = $row->ftp_port; $ftp_user = $row->ftp_user; $ftp_pass = $row->ftp_pass; $ftp_root = $row->ftp_root; $ftp_createdir = $uploadfolder; $conn_id = ftp_connect($ftp_host, $ftp_port); $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass); ftp_chdir($conn_id, $ftp_root); $result = ftp_mkdir ($conn_id , $ftp_createdir); if ($result && $dir_chmod != 0) { @ftp_chmod($conn_id, $dir_chmod, $ftp_createdir); } ftp_close($conn_id); } else { $result = mkdir($uploadfolder); if ($result && $dir_chmod != 0) { @chmod($uploadfolder, $dir_chmod); } } // if the copy directory exists we copy everything! $extra_dir = "components/com_jfuploader/default"; if (file_exists($extra_dir)) { JFUHelper::dir_copy($extra_dir, $uploadfolder); } } } else { return HTML_joomla_flash_uploader::noUser($id,true); } } if (file_exists("components/com_jfuploader/tfu/tfu_helper.php")) { $prefix_path = ''; $prefix_dir_path = ''; } else { $prefix_path = 'administrator/'; $prefix_dir_path = '../'; } // we go back to the main folder! if ($uploadfolder == "") { $folder = './'.$prefix_dir_path.'../../..'; } else { $folder = './'.$prefix_dir_path.'../../../' . $uploadfolder; } JFUHelper::setJFUSession($row, $folder, $database); unset($_SESSION["IS_ADMIN"]); $_SESSION["IS_FRONTEND"] = "TRUE"; if ($user->id != 0) { $_SESSION["TFU_USER"] = $user->username; $_SESSION["TFU_USER_ID"] = $user->id; $_SESSION["TFU_USER_NAME"] = $user->name; $_SESSION["TFU_USER_EMAIL"] = $user->email; JFUHelper::setContactDetailsToSession($user->id); } else { unset($_SESSION['TFU_USER']); unset($_SESSION['TFU_USER_ID']); unset($_SESSION['TFU_USER_NAME']); unset($_SESSION['TFU_USER_EMAIL']); unset($_SESSION['TFU_USER_CONTACT']); } // we check if the flash should be included with js oder the object tag $use_js_include = JFUHelper::check_js_include($database); $jfu_config['idn_url']= JFUHelper::getVariable($database, 'idn_url'); store_temp_session(); JFUHelper::fixSession(); $thumbnailflash = ''; if ($twgpath != '') { $thumbnailflash = $this->getFlashContent($twgpath, $uploadfolder,$use_js_include); } return HTML_joomla_flash_uploader::showFlash( $row, $uploadfolder, $use_js_include, $jfu_config, true ) . $thumbnailflash; } }
function showFlashComponent($id, $user, $editor_plugin, $block_type, $jfu_params) { global $prefix_dir_path, $prefix_path; $database =& JFactory::getDBO(); $row = new joomla_flash_uploader($database); $row->load($id); if (!$row->resize_show) { // no profile found or no id! HTML_joomla_flash_uploader::wrongId($id); } else { $uploadfolder = $row->folder; $uploadfolder_base = $uploadfolder; // we check if we have a master profile! if ($row->master_profile == 'true') { if ($user->id != 0 || $row->master_profile_mode == 'ip') { if ($row->master_profile_mode == 'id') { $_SESSION["s_user"] = $user->id; $uploadfolder = $uploadfolder . '/' . $user->id; } else { if ($row->master_profile_mode == 'ip') { $uploadfolder = $uploadfolder . '/' . $_SERVER['REMOTE_ADDR']; } else { if ($row->master_profile_mode == 'group') { $group = JFUHelper::getHighestGroupName($database, $user->groups); if ($row->master_profile_lowercase == 'true') { $normalizeSpaces = true; $group = normalizeFileNames($group); } $uploadfolder = $uploadfolder . '/' . $group; } else { if ($row->master_profile_mode == 'login') { $uname = $user->username; } else { $uname = $user->name; } $_SESSION["s_user"] = $uname; if ($row->master_profile_lowercase == 'true') { $normalizeSpaces = true; $uname = normalizeFileNames($uname); } $uploadfolder = $uploadfolder . '/' . $uname; } } } // we check if the folder exists - if not it is created! if (!file_exists($uploadfolder) && $uploadfolder != "") { $dir_chmod = JFUHelper::getVariable($database, 'dir_chmod'); $ftp_enable = $row->ftp_enable; if (isset($ftp_enable) && $ftp_enable == 'true') { $ftp_host = $row->ftp_host; $ftp_port = $row->ftp_port; $ftp_user = $row->ftp_user; $ftp_pass = $row->ftp_pass; $ftp_root = $row->ftp_root; $ftp_createdir = $uploadfolder; $conn_id = ftp_connect($ftp_host, $ftp_port); $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass); ftp_chdir($conn_id, $ftp_root); $result = ftp_mkdir($conn_id, $ftp_createdir); if ($result && $dir_chmod != 0) { @ftp_chmod($conn_id, $dir_chmod, $ftp_createdir); } ftp_close($conn_id); } else { $result = mkdir($uploadfolder); if ($result && $dir_chmod != 0) { @chmod($uploadfolder, $dir_chmod); } } // if the copy directory exists we copy everything! $extra_dir = "components/com_jfuploader/default"; if (file_exists($extra_dir)) { JFUHelper::dir_copy($extra_dir, $uploadfolder); } } } else { HTML_joomla_flash_uploader::noUser($id); return; } } // we go back to the main folder! path has to be relativ to the tfu upload folder! if ($uploadfolder == "") { $folder = './' . $prefix_dir_path . '../../..'; } else { $folder = './' . $prefix_dir_path . '../../../' . $uploadfolder; } JFUHelper::setJFUSession($row, $folder, $database); unset($_SESSION["IS_ADMIN"]); $_SESSION["IS_FRONTEND"] = "TRUE"; if ($user->id != 0) { $_SESSION["TFU_USER"] = $user->name; $_SESSION["TFU_USER_ID"] = $user->id; $_SESSION["TFU_USER_NAME"] = $user->username; $_SESSION["TFU_USER_EMAIL"] = $user->email; JFUHelper::setContactDetailsToSession($user->id); } else { unset($_SESSION['TFU_USER']); unset($_SESSION['TFU_USER_ID']); unset($_SESSION['TFU_USER_NAME']); unset($_SESSION['TFU_USER_EMAIL']); unset($_SESSION['TFU_USER_CONTACT']); } // we check if the flash should be included with js oder the object tag $use_js_include = JFUHelper::check_js_include($database); $jfu_config['idn_url'] = JFUHelper::getVariable($database, 'idn_url'); if (!$editor_plugin) { JFUHelper::fixSession(); store_temp_session(); HTML_joomla_flash_uploader::showFlash($row, $uploadfolder, $use_js_include, $jfu_config, false); } else { $_SESSION['TFU']['IS_JFU_PLUGIN'] = true; JFUHelper::fixSession(); store_temp_session(); // I have to set the javascript setting to update the data! $flash = HTML_joomla_flash_uploader::showFlash($row, $uploadfolder, $use_js_include, $jfu_config, true); echo ' <style type="text/css"> body.contentpane { background-color:#ffffff; margin-top:15px; margin-left:15px; margin-bottom:0px; overflow-y: hidden; overflow-x: hidden; line-height: 1.4;} #main { padding: 0px;} </style>'; echo $flash; $base_path = JURI::base(); HTML_joomla_flash_uploader::showImageSelector($base_path, $block_type, $jfu_params); } } }
function showPlugins() { $database = JFactory::getDBO(); $my = JFactory::getUser(); if (checkAccess($database, 'core.admin')) { $plugins = array(); $show_hint = false; foreach (glob(dirname(__FILE__) . '/tfu/*_plugin.php') as $filename) { $name = 'Not set'; $description = 'Not set'; $version_plugin = 'Not set'; $version_tfu = 'Not set'; $content = file_get_contents($filename); $hits = preg_match('/(Name:)([^\\n]*)(\\n)/i', $content, $treffer); if ($hits != 0) { $name = trim($treffer[2]); } $hits = preg_match('/(Description:)([^\\n]*)(\\n)/i', $content, $treffer); if ($hits != 0) { $description = trim($treffer[2]); } $hits = preg_match('/(Version Plugin:)([^\\n]*)(\\n)/i', $content, $treffer); if ($hits != 0) { $version_plugin = trim($treffer[2]); } $hits = preg_match('/(Needed flash version:)([^\\n]*)(\\n)/i', $content, $treffer); if ($hits != 0) { $version_tfu = trim($treffer[2]); if (version_compare($version_tfu, JFUHelper::getVariable($database, 'version')) == 1) { $version_tfu = 'style="color: #ff0000;"'; $show_hint = true; } else { $version_tfu = ''; } } $plugins[] = array(basename($filename), htmlentities($name), htmlentities($description), $version_plugin, $version_tfu); } $available = array("a_plugin", "move_plugin"); HTML_joomla_flash_uploader::showPlugins($plugins, $show_hint); } else { HTML_joomla_flash_uploader::errorRights(); } }
function showConfig() { $database =& JFactory::getDBO(); $my =& JFactory::getUser(); if (checkAccess($database, $my->usertype, 'backend_access_config')) { $i = 0; $database->setQuery("SELECT * FROM #__joomla_flash_uploader where id > 0 ORDER BY id "); $rows = $database->loadObjectList(); if (count($rows) > 0) { foreach ($rows as $row) { if ($row->id == 1) { $rows[$i]->resize_label = JText::_('C_ADMINS_ONLY'); } else { $database->setQuery("SELECT username FROM #__users u, #__joomla_flash_uploader_user f WHERE u.id = f.user AND f.profile =" . $row->id . " order by username"); $users = $database->loadObjectList("username"); $rows[$i]->resize_label = "<a href=\"#user\" onclick=\"return submitform('user')\">"; if (count($users) == 0) { if ($rows[$i]->gid != "") { $rows[$i]->resize_label .= JText::_('C_DEFAULT_PROFILE') . '</a>'; } else { $rows[$i]->resize_label = JText::_('C_NO_GROUP'); } } else { $ret = array(); foreach ($users as $user) { array_push($ret, $user->username); } $rows[$i]->resize_label .= implode(", ", $ret); $rows[$i]->resize_label .= "</a>"; } } $i++; } } $jfu_config = array(); $jfu_config['keep_tables'] = JFUHelper::getVariable($database, 'keep_tables'); $jfu_config['use_js_include'] = JFUHelper::getVariable($database, 'use_js_include'); $jfu_config['backend_access_upload'] = JFUHelper::getVariable($database, 'backend_access_upload'); $jfu_config['backend_access_config'] = JFUHelper::getVariable($database, 'backend_access_config'); $jfu_config['version'] = JFUHelper::getVariable($database, 'version'); $jfu_config['file_chmod'] = JFUHelper::getVariable($database, 'file_chmod'); $jfu_config['dir_chmod'] = JFUHelper::getVariable($database, 'dir_chmod'); HTML_joomla_flash_uploader::listConfig($rows, $jfu_config); } else { HTML_joomla_flash_uploader::errorRights(); } }