コード例 #1
0
             $contents = @file_get_contents($pl_path . '/' . $file);
             $gtree = $XML->xml_to_array($contents);
             if ($gtree != false) {
                 $plg_dsc = $gtree['kleeja']['info']['plugin_description'];
                 if (isset($plg_dsc)) {
                     if (is_array($plg_dsc['description']) && array_key_exists("attributes", $plg_dsc['description'])) {
                         $plg_dsc['description'] = array($plg_dsc['description']);
                     }
                     $p_desc = array();
                     foreach ($plg_dsc['description'] as $in) {
                         $p_desc[$in['attributes']['lang']] = $in['value'];
                     }
                 }
                 $installed_plugins[] = array('p_file' => $file, 'p_name' => htmlspecialchars($gtree['kleeja']['info']['plugin_name']['value']), 'p_ver' => htmlspecialchars($gtree['kleeja']['info']['plugin_version']['value']), 'p_des' => isset($p_desc[getlang()]) ? $p_desc[getlang()] : $p_desc['en']);
                 //we dont care about the return value here !
                 $plg->add_plugin($contents);
             }
         }
     }
     $plg->atend();
     //clean cache
     delete_cache(null, true);
     echo gettpl('plugins_done.html');
 } else {
     $plugins = array();
     $dh = opendir($pl_path);
     while (($file = readdir($dh)) !== false) {
         $e = @explode(".", $file);
         $e = strtolower($e[sizeof($e) - 1]);
         if ($e == "klj") {
             $contents = @file_get_contents($pl_path . '/' . $file);
コード例 #2
0
ファイル: j_plugins.php プロジェクト: Saleh7/Kleeja
         kleeja_admin_err($lang['EMPTY_FIELDS'], true, '', true, basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php'));
     } else {
         $plg->info = $ftpinfo = array('host' => $_POST['ftp_host'], 'port' => $_POST['ftp_port'], 'user' => $_POST['ftp_user'], 'pass' => $_POST['ftp_pass'], 'path' => $_POST['ftp_path']);
         $ftpinfo['pass'] = '';
         update_config('ftp_info', serialize($ftpinfo), false);
         if (!$plg->check_connect()) {
             kleeja_admin_err($lang['LOGIN_ERROR'], true, '', true, basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php') . '?#!cp=' . basename(__FILE__, '.php'));
         }
     }
 } else {
     if (isset($_POST['_fmethod']) && $_POST['_fmethod'] == 'zfile') {
         $plg->f_method = 'zfile';
         $plg->check_connect();
     }
 }
 $return = $plg->add_plugin($contents);
 $plg->atend();
 switch ($return) {
     //plugin added
     case 'done':
         $text = $lang['NEW_PLUGIN_ADDED'];
         $text .= '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php') . '\');", 2000);</script>' . "\n";
         break;
     case 'xyz':
         //exists before
         kleeja_admin_err($lang['PLUGIN_EXISTS_BEFORE'], true, '', true, basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php'));
         break;
     case 'upd':
         // updated success
         $text = $lang['PLUGIN_UPDATED_SUCCESS'];
         break;