/** * Writes a list of the defined modules * @param array An array of category objects */ static function showPlugins( &$rows, &$pageNav, $option, &$lists, $search ) { global $_CB_framework, $_PLUGINS; HTML_comprofiler::secureAboveForm('showPlugins'); outputCbTemplate( 2 ); outputCbJs( 2 ); initToolTip( 2 ); global $_CB_Backend_Title; $_CB_Backend_Title = array( 0 => array( 'cbicon-48-plugins', htmlspecialchars( CBTxt::T('CB Plugin Manager') ) . ' <small><small> <a href="#getplugins">' . htmlspecialchars( CBTxt::T('Get Plugins') ) . '</a></small></small>' . ' ' . ' <small><small> <a href="#install">' . htmlspecialchars( CBTxt::T('Install Plugin') ) . '</a></small></small>' ) ); HTML_comprofiler::_saveOrderJs( 'savepluginorder' ); ob_start(); ?> function submitbutton3(pressbutton) { var form = document.adminForm_dir; // do field validation if (form.userfile.value == ""){ alert('<?php echo addslashes( CBTxt::T('Please select a directory') ); ?>'); } else { form.submit(); } } <?php $js = ob_get_contents(); ob_end_clean(); $_CB_framework->document->addHeadScriptDeclaration( $js ); ?> <form action="<?php echo $_CB_framework->backendUrl( 'index.php' ); ?>" method="post" name="adminForm"> <table class="adminheading" style="width:100%"> <tr> <td style="width:80%"> <?php echo htmlspecialchars( CBTxt::T('Filter') ); ?>: <input type="text" name="search" value="<?php echo htmlspecialchars( $search );?>" class="text_area" onChange="document.adminForm.submit();" /> </td> <td align="right"> <?php echo $lists['type'];?> </td> </tr> </table> <table class="adminlist"> <thead> <tr> <th width="20"><?php echo htmlspecialchars( CBTxt::T('#') ); ?></th> <th width="20"> <input type="checkbox" name="toggle" value="" <?php echo 'onclick="checkAll(' . count( $rows ) . ');"';?> /> </th> <th class="title"> <?php echo htmlspecialchars( CBTxt::T('Plugin Name') ); ?> </th> <th nowrap="nowrap" width="5%"> <?php echo htmlspecialchars( CBTxt::T('Installed') ); ?> </th> <th nowrap="nowrap" width="5%"> <?php echo htmlspecialchars( CBTxt::T('Published') ); ?> </th> <th colspan="2" nowrap="nowrap" width="5%"> <?php echo htmlspecialchars( CBTxt::T('Reorder') ); ?> </th> <th width="2%"> <?php echo htmlspecialchars( CBTxt::T('Order') ); ?> </th> <th width="4%"> <a href="javascript: cbsaveorder( <?php echo count( $rows )-1; ?> )"><img src="../components/com_comprofiler/plugin/templates/luna/images/mini-icons/icon-16-filesave.png" border="0" width="16" height="16" alt="<?php echo htmlspecialchars( CBTxt::T('Save Order') ); ?>" /></a> </th> <th nowrap="nowrap" align="left" width="10%"> <?php echo htmlspecialchars( CBTxt::T('Access') ); ?> </th> <th nowrap="nowrap" align="left" width="10%"> <?php echo htmlspecialchars( CBTxt::T('Type') ); ?> </th> <th nowrap="nowrap" align="left" width="10%"> <?php echo htmlspecialchars( CBTxt::T('Directory') ); ?> </th> </tr> </thead> <tbody> <?php $k = 0; for ($i=0, $n=count( $rows ); $i < $n; $i++) { $row = &$rows[$i]; $xmlfile = $_PLUGINS->getPluginXmlPath( $row ); $filesInstalled = file_exists($xmlfile); $link = $_CB_framework->backendUrl( "index.php?option=com_comprofiler&task=editPlugin&cid=$row->id" ); //Access if ( !$row->access ) { $color_access = 'style="color: green;"'; $task_access = 'accessregistered'; } else if ( $row->access == 1 ) { $color_access = 'style="color: red;"'; $task_access = 'accessspecial'; } else { $color_access = 'style="color: black;"'; $task_access = 'accesspublic'; } $access = ' <a href="javascript: void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $task_access .'\')" '. $color_access .'> '. $row->groupname .' </a>'; //Checked Out if ( $filesInstalled && $row->checked_out ) { $hover = ''; $date = cbFormatDate( $row->checked_out_time ); $checked_out_text = '<table>'; $checked_out_text .= '<tr><td>'. addslashes($row->editor) .'</td></tr>'; $checked_out_text .= '<tr><td>'. $date .'</td></tr>'; $checked_out_text .= '</table>'; $hover = 'onMouseOver="return overlib(\''. htmlspecialchars( $checked_out_text ) .'\', CAPTION, \'Checked Out\', BELOW, RIGHT);" onMouseOut="return nd();"'; if ( checkJversion() == 2 ) { $checked_img = 'templates/hathor/images/admin/checked_out.png'; } else { $checked_img = 'images/checked_out.png'; } $checked = '<img src="'. $checked_img .'" '. $hover .'/>'; } else { $checked = '<input type="checkbox" id="cb'.$i.'" name="cid[]" value="'.$row->id.'" onclick="isChecked(this.checked);" />'; } $imgpath='../components/com_comprofiler/images/'; //Installedg $instImg = $filesInstalled ? 'tick.png' : 'publish_x.png'; $instAlt = htmlspecialchars( $filesInstalled ? CBTxt::T('Installed') : CBTxt::T('Plugin Files missing') ); $installed = '<img src="' . $imgpath . $instImg .'" border="0" alt="'. $instAlt .'" title="'. $instAlt .'" />'; //Published $img = $row->published ? 'publish_g.png' : 'publish_x.png'; $task = $row->published ? 'unpublishPlugin' : 'publishPlugin'; $alt = $row->published ? CBTxt::T('Published') : CBTxt::T('Unpublished'); $action = $row->published ? CBTxt::T('Unpublish Item') : CBTxt::T('Publish item'); if ( ( $row->type == "language" ) && $row->published ) { $published = '<img src="' . $imgpath . 'publish_g.png" border="0" alt="' . htmlspecialchars( CBTxt::T('Published') ) . '" title="' . htmlspecialchars( CBTxt::T('language plugins cannot be unpublished, only uninstalled') ) . '" />'; } elseif ( ( $row->id == 1 ) && $row->published ) { $published = '<img src="' . $imgpath . 'publish_g.png" border="0" alt="' . htmlspecialchars( CBTxt::T('Published') ) . '" title="' . htmlspecialchars( CBTxt::T('CB core plugin cannot be unpublished') ) . '" />'; } else { $published = '<a href="javascript: void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $task .'\')" title="'. htmlspecialchars( $action ) .'"> <img src="'. $imgpath . $img .'" border="0" alt="'. htmlspecialchars( $alt ) .'" /> </a>'; } //Backend plugin menu: $backendPluginMenus = array(); if ( isset( $row->backend_menu ) && $row->backend_menu ) { $backend = explode( ",", $row->backend_menu ); foreach ( $backend as $backendAction ) { $backendActionParts = explode( ":", $backendAction ); $backendActionLink = $_CB_framework->backendUrl( "index.php?option=com_comprofiler&task=pluginmenu&pluginid=$row->id&menu=$backendActionParts[1]" ); $backendPluginMenus[] = ' [<a href="' . $backendActionLink . '">' . $backendActionParts[0] . '</a>] '; } } ?> <tr class="<?php echo "row$k"; ?>"> <td align="right"><?php echo $i + 1 + $pageNav->limitstart ?></td> <td> <?php echo $checked; ?> </td> <td> <?php if ( ($row->checked_out && ( $row->checked_out != $_CB_framework->myId() )) || !$filesInstalled ) { if ( ! $filesInstalled ) { echo '<span title="' . $instAlt , '">'; } echo $row->name; if ( ! $filesInstalled ) { echo "</span>"; } } else { ?> <a href="<?php echo $link; ?>"> <?php echo htmlspecialchars( $row->name ); ?> </a> <?php echo implode( '', $backendPluginMenus ); } ?> </td> <td align="center"> <?php echo $installed;?> </td> <td align="center"> <?php echo $published;?> </td> <td> <?php if (($i > 0 || ($i+$pageNav->limitstart > 0)) && $row->type == @$rows[$i-1]->type) { ?> <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderupPlugin')"> <img src="../components/com_comprofiler/plugin/templates/luna/images/mini-icons/icon-12-uparrow.png" width="12" height="12" border="0" alt="<?php echo htmlspecialchars( CBTxt::T('Move Up') ); ?>" /> </a> <?php } ?> </td> <td> <?php if (($i < $n-1 || $i+$pageNav->limitstart < $pageNav->total-1) && $row->type == @$rows[$i+1]->type) { ?> <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderdownPlugin')"> <img src="../components/com_comprofiler/plugin/templates/luna/images/mini-icons/icon-12-downarrow.png" width="12" height="12" border="0" alt="<?php echo htmlspecialchars( CBTxt::T('Move Down') ); ?>" /> </a> <?php } ?> </td> <td align="center" colspan="2"> <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" class="text_area" style="text-align: center" /> </td> <td align="left"> <?php echo $access;?> </td> <td align="left" nowrap="nowrap"> <?php echo $row->type;?> </td> <td align="left" nowrap="nowrap"> <?php if ( ! $filesInstalled ) { echo '<span style="text-decoration:line-through" title="' . $instAlt , '">'; } echo $row->element; if ( ! $filesInstalled ) { echo "</span>"; } ?> </td> </tr> <?php $k = 1 - $k; } ?> </tbody> <tfoot> <tr> <th align="center" colspan="12"> <?php echo $pageNav->getListFooter(); ?></th> </tr> </tfoot> </table> <input type="hidden" name="option" value="<?php echo $option;?>" /> <input type="hidden" name="task" value="showPlugins" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="hidemainmenu" value="0" /> <?php echo cbGetSpoofInputTag( 'plugin' ); ?> </form> <div style="clear:both; margin:20px 0px;"> <table class="adminheading"> <tr> <th class="install"> <a name="getplugins"><?php echo htmlspecialchars( CBTxt::T('Get Plugins') ); ?></a> </th> </tr> <tr> <td align="left" style="padding-bottom:10px;"> <a href="http://www.joomlapolis.com/cb-solutions" target="_blank"><?php echo htmlspecialchars( CBTxt::T('Click here to see more CB Plugins (Languages, Fields, Tabs, Signup-Connect, Paid Memberships and over 30 more) by CB Team at joomlapolis.com') ); ?></a> </td> </tr> <tr> <td align="left" style="padding-bottom:10px;"> <a href="http://www.joomlapolis.com/cb-solutions/directory" target="_blank"><?php echo htmlspecialchars( CBTxt::T('Click here to see CB Directory listing hundreds of CB extensions at joomlapolis.com') ); ?></a> </td> </tr> <tr> <td align="left" style="padding-bottom:10px;"> <a href="http://extensions.joomla.org/extensions/clients-a-communities/communities/210" target="_blank"><?php echo htmlspecialchars( CBTxt::T('Click here to Check our CB listing on JED and find more third-party free add-ons for your website') ); ?></a> </td> </tr> </table> </div> <div style="clear:both;"> <table class="adminheading"> <tr> <th class="install"> <a name="install"><?php echo htmlspecialchars( CBTxt::T('Install New Plugin') ); ?></a> </th> </tr> </table> <form enctype="multipart/form-data" action="<?php echo $_CB_framework->backendUrl( 'index.php' ); ?>" method="post" name="filename"> <table class="adminform"> <tr> <th> <?php echo htmlspecialchars( CBTxt::T('Upload Package File') ); ?> </th> </tr> <tr> <td align="left"> <?php echo htmlspecialchars( CBTxt::T('Package File:') ); ?> <input class="text_area" name="userfile" type="file" size="70"/> <input class="button" type="submit" value="<?php echo htmlspecialchars( CBTxt::T('Upload File & Install') ); ?>" /> <?php echo CBTxt::P( 'Maximum upload size: <strong>[filesize]</strong> <em>(upload_max_filesize setting in file [php.ini] )</em>', array( '[filesize]' => ini_get( 'upload_max_filesize' ), '[php.ini]' => ( is_callable( 'php_ini_loaded_file' ) && php_ini_loaded_file() ? htmlspecialchars( php_ini_loaded_file() ) : 'php.ini' ) ) ); ?> </td> </tr> </table> <input type="hidden" name="task" value="installPluginUpload"/> <input type="hidden" name="option" value="com_comprofiler"/> <input type="hidden" name="client" value=""/> <?php echo cbGetSpoofInputTag( 'plugin' ); ?> </form> <br /> <form enctype="multipart/form-data" action="<?php echo $_CB_framework->backendUrl( 'index.php' ); ?>" method="post" name="adminForm_dir"> <table class="adminform"> <tr> <th> <?php echo htmlspecialchars( CBTxt::T('Install from directory') ); ?> </th> </tr> <tr> <td align="left"> <?php echo htmlspecialchars( CBTxt::T('Install directory') ); ?>: <input type="text" name="userfile" class="text_area" size="65" value=""/> <input type="button" class="button" value="<?php echo htmlspecialchars( CBTxt::T('Install') ); ?>" onclick="submitbutton3()" /> </td> </tr> </table> <input type="hidden" name="task" value="installPluginDir" /> <input type="hidden" name="option" value="com_comprofiler"/> <input type="hidden" name="client" value=""/> <?php echo cbGetSpoofInputTag( 'plugin' ); ?> </form> <br /> <form enctype="multipart/form-data" action="<?php echo $_CB_framework->backendUrl( 'index.php' ); ?>" method="post" name="adminForm_URL"> <table class="adminform"> <tr> <th> <?php echo htmlspecialchars( CBTxt::T('Install package from web (http/https)') ); ?> </th> </tr> <tr> <td align="left"> <?php echo htmlspecialchars( CBTxt::T('Installation package URL') ); ?>: <input type="text" name="userfile" class="text_area" size="65" value=""/> <input class="button" type="submit" value="<?php echo htmlspecialchars( CBTxt::T('Download Package & Install') ); ?>" /> </td> </tr> </table> <input type="hidden" name="task" value="installPluginURL" /> <input type="hidden" name="option" value="com_comprofiler"/> <input type="hidden" name="client" value=""/> <?php echo cbGetSpoofInputTag( 'plugin' ); ?> </form> <br /> <table class="content"> <?php if (!is_callable(array("JFile","write")) || ($_CB_framework->getCfg('ftp_enable') != 1)) { writableCell( 'components/com_comprofiler/plugin/user' ); // writableCell( 'components/com_comprofiler/plugin/fieldtypes' ); writableCell( 'components/com_comprofiler/plugin/templates' ); writableCell( 'components/com_comprofiler/plugin/language' ); } writableCell( 'media' ); ?> </table> </div> <?php }
function finishInstallation($option) { global $_CB_framework, $ueConfig, $task; // Try extending time, as unziping/ftping took already quite some... : @set_time_limit(240); HTML_comprofiler::secureAboveForm('finishInstallation'); $tgzFile = $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/pluginsfiles.tgz'; $installerFile = $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/'; if (file_exists($installerFile . 'comprofiler.xml')) { $installerFile .= 'comprofiler.xml'; } elseif (file_exists($installerFile . 'comprofilej.xml')) { $installerFile .= 'comprofilej.xml'; } elseif (file_exists($installerFile . 'comprofileg.xml')) { $installerFile .= 'comprofileg.xml'; } if (!file_exists($tgzFile)) { echo _UE_NOT_AUTHORIZED; return; } $installer = new cbInstallerPlugin(); $client = 2; // Check that the zlib is available if (!extension_loaded('zlib')) { HTML_comprofiler::showInstallMessage(CBTxt::T('The installer cannot continue before zlib is installed'), CBTxt::T('Installer - Error'), $installer->returnTo($option, $task, $client)); exit; } if (!$installer->upload($tgzFile, true, false)) { HTML_comprofiler::showInstallMessage(sprintf(CBTxt::T("Uncompressing %s failed."), $tgzFile), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); exit; } $installFrom = $installer->installDir(); $installTo = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin'; $filesList = cbReadDirectory($installFrom, '.', true); // create directories and remove them from file list: if (!$installer->mosMakePath(dirname($installTo) . '/', 'plugin')) { HTML_comprofiler::showInstallMessage(sprintf(CBTxt::T('Failed to create directory "%s"'), $installTo . '/plugin'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); exit; } foreach ($filesList as $k => $file) { if (basename($file) != $file) { $newdir = dirname($file); if (!$installer->mosMakePath($installTo . '/', $newdir)) { HTML_comprofiler::showInstallMessage(sprintf(CBTxt::T('Failed to create directory "%s"'), $installTo . '/' . $newdir), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); exit; } } if (!is_file($installFrom . '/' . $file)) { unset($filesList[$k]); } } $result = $installer->copyFiles($installFrom, $installTo, $filesList, true); if ($result === false) { HTML_comprofiler::showInstallMessage(sprintf(CBTxt::T("Copying plugin files failed with error: %s"), $installer->getError()), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); exit; } $adminFS =& cbAdminFileSystem::getInstance(); $result = $adminFS->deldir(_cbPathName($installFrom . '/')); if ($result === false) { HTML_comprofiler::showInstallMessage(CBTxt::T('Deleting expanded tgz file directory failed with an error.'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); } $tgzFileOS = _cbPathName($tgzFile, false); $result = $adminFS->unlink($tgzFileOS); if ($result === false) { HTML_comprofiler::showInstallMessage(sprintf(CBTxt::T("Deleting file %s failed with an error."), $tgzFileOS), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); } // adapt published fields to global CB config (regarding name type) _cbAdaptNameFieldsPublished($ueConfig); $htmlToDisplay = $_CB_framework->getUserState('com_comprofiler_install'); // clears the session buffer memory after installaion done: $_CB_framework->setUserState('com_comprofiler_install', ''); cbimport('cb.xml.simplexml'); $installerXml = new CBSimpleXMLElement(file_get_contents($installerFile)); if (is_object($installerXml)) { $description = $installerXml->getElementByPath('description'); if ($description !== false) { echo '<h2>' . $description->data() . '</h2>'; } } echo $htmlToDisplay; ?> <div style="font-weight:bold;font-size:110%;background:#ffffe4;border:2px green solid;padding:5px;margin-bottom:20px;"><font color="green"><?php echo CBTxt::T('Second and last installation step of Community Builder Component (comprofiler) done successfully.'); ?> </font></div><br /> <div style="font-weight:bold;font-size:125%;background:#ffffe4;border:2px green solid;padding:5px;"> <font color="green"><b><?php echo CBTxt::T('Installation finished. Important: Please read README.TXT and installation manual for further settings.'); ?> <br /><br /><?php echo CBTxt::T('We also have a PDF installation guide as well as a complete documentation available on'); ?> <a href="http://www.joomlapolis.com">www.joomlapolis.com</a> <?php echo CBTxt::T('which will help you making the most out of your Community Builder installation, while supporting this project, as well as plugins and templates.'); ?> </b></font> </div> <?php $_CB_framework->setUserState("com_comprofiler_install", ''); }