ephesus: Loginbox und Downloadliste kombinieren?

Gesperrt
HerrB
Beiträge: 6935
Registriert: Do 22. Mai 2003, 12:44
Wohnort: Berlin
Kontaktdaten:

ephesus: Loginbox und Downloadliste kombinieren?

Beitrag von HerrB »

Aus einer PM:
ephesus hat geschrieben:vielleicht können Sie mir helfen. Ich habe folgendes Problem, es gibt das Modul "Loginbox" von Andreas Lindner und das Modul "Downloadliste" von Strese....ich möchte beides so kombinieren, so dass ein User nur über diese Loginbox auf die Downloadseite weitergeleitet wird. Ist das mit diesen beiden Modulen möglich? Wenn ja wie muss ich das vorgehen?
Gruß
HerrB
Bitte keine unaufgeforderten PMs oder E-Mails -> use da Forum!

Newsletter: V4.4.x | V4.6.0-15 (Module, Backend) | V4.6.22+
Standardartikelliste: V4.4.x | V4.6.x
http://www.contenido.org/forum/search.php | http://faq.contenido.org | http://www.communido.net
OliverL
Beiträge: 870
Registriert: Do 28. Jun 2007, 09:28
Kontaktdaten:

Beitrag von OliverL »

Hab ihm geholfen. Ist erledigt.

werde Ihn aber noch bitten das Resultat mal hier einzustellen oder mir zuschicken dann stell ich das hier rein.

mfg
Oli
ephesus
Beiträge: 23
Registriert: Di 20. Mär 2007, 14:45
Kontaktdaten:

Beitrag von ephesus »

Input:

Code: Alles auswählen

?><?php
# CMS VAR  1 = Display-Typ
# CMS VAR  2 = fegroup
cInclude("classes", "class.frontend.groups.php");

$fegroups = new FrontendGroupCollection;
$fegroups->select("idclient = '$client'","", "groupname ASC");

?>

<table cellspacing="0" cellpadding="2" border="0" width="100%">
  <tr>
    <td valign="top" style="padding-top: 2px;"><?php echo mi18n("Display:"); ?></td>
    <td>
        <select name="CMS_VAR[1]" class="text_medium" style="width: 100%;">
          <option onClick="document.getElementById('komentar_feu_group').style.display = 'none';" value="1"<?php  echo ("CMS_VALUE[1]"=='1' ? ' selected' : ''); ?>><?php echo mi18n("Hidden"); ?></option>
          <option onClick="document.getElementById('komentar_feu_group').style.display = 'none';" value="2"<?php  echo ("CMS_VALUE[1]"=='2' ? ' selected' : ''); ?>><?php echo mi18n("Display"); ?></option>
          <option onClick="document.getElementById('komentar_feu_group').style.display = 'block';" value="3"<?php  echo ("CMS_VALUE[1]"=='3' ? ' selected' : ''); ?>><?php echo mi18n("FEU"); ?></option>
        </select>
      <div id="komentar_feu_group" style="display: <?php echo ("CMS_VALUE[1]"== "3" ? 'block' : 'none'); ?>;">
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
         <tr>
            <td><?php echo mi18n("Frontendgroup"); ?>:</td>
         </tr>
        <tr>
         <td>
              <select size="5" onchange="var myValue = ''; for( i = 0; i < this.options.length; i++ ) { if( this.options[i].selected ) myValue += ','+this.options[i].value; } document.getElementById('cmsVar2').value = myValue.substr(1);" class="text_medium" style="width: 100%;" multiple="multiple">
            <?php
            $mySelectedGroups = explode(',', "CMS_VALUE[2]");
            while ($fegroup = $fegroups->next()) {
               $groupname = $fegroup->get("groupname");
               $idfegroup = $fegroup->get("idfrontendgroup");
               echo '<option value="'.$idfegroup.'"'.( in_array($idfegroup, $mySelectedGroups) ? ' selected' : '' ).'>'.$groupname.'</option>';
            }
            ?>
            </select>
         <input id="cmsVar2" name="CMS_VAR[2]" type="hidden" value="CMS_VALUE[2]">
         </td>
        </tr>
      </table>
      </div>
    </td>
  </tr>
</table>

<?php

##############################################################################################
?>
<?php
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname  :    Download List
* Author(s)  :    Stefan Seifarth <info@polycoder.de>
* Copyright  :    www.polycoder.de / www.htcm.de
* Created    :    2006-01-07
************************************************/ 

cInclude ("classes", "class.upload.php");


// get all directories from database
$dllist_collection = new UploadCollection ();
$dllist_collection->select("","dirname","dirname ASC");

$arr_found_dirs = array();
$arr_dirs = array();
while ( $dllist_item = $dllist_collection->next() ) {
   $arr_found_dirs[] = $dllist_item->get("dirname");
}

$i = 0;
foreach ($arr_found_dirs as $str_dir) {
   $arr_current_dir =  explode("/",$str_dir );
   array_pop($arr_current_dir);
   
   $depth = count($arr_current_dir);
   
   if ( $depth == 0 ) {
      $arr_dirs[$i]["name"] = str_replace("/", "", $cfgClient[$client]["upload"]);
   } else {
      $arr_dirs[$i]["name"] = $arr_current_dir[$depth-1];
   }
   $arr_dirs[$i]["depth"] = $depth;
   $arr_dirs[$i]["path"] = $str_dir;
   $arr_dirs[$i]["indent"] = "";
   
   for ($z = 1; $z <= $depth; $z ++) {
      # 3 blanks for every level
      $arr_dirs[$i]["indent"] .= "&nbsp;&nbsp;&nbsp;";
   } 
   
   $i++;
}


// print out directory selectbox
$str_predefined = trim("CMS_VALUE[110]");

print mi18n("Verzeichnis für Downloads auswählen") . ":\n<br>";
print '<select name="CMS_VAR[110]">' . "\n";
// output of all found directories
foreach ( $arr_dirs  as $arr_dir ) {
   $str_selected = "";
   if ( $str_predefined == $arr_dir["path"] ) $str_selected = ' selected="selected"';
   
   print '<option value="' . $arr_dir["path"] . '"' . $str_selected . '>' . $arr_dir["indent"] . $arr_dir["name"] . '</option>' . "\n";
}
print '</select>' . "\n";

print '<br><br>' . "\n";

// print out fileextensions
print mi18n("sichtbare Dateiendungen<br>(leergelassen = alle Dateien, mehrere Dateitypen durch Komma abtrennen )") . ":\n<br>";
print '<input type="text" name="CMS_VAR[111]" value="CMS_VALUE[111]">' . "<br><br>\n";

// print out download article
print mi18n("Artikel idart für Downloadzähler<br>(leergelassen = Download ohne Zähler)") . ":\n<br>";
print '<input type="text" name="CMS_VAR[112]" value="CMS_VALUE[112]">' . "\n";

?>
<?php
Output:

Code: Alles auswählen

<?php


cInclude("classes", "class.frontend.groups.php");
cInclude('classes', 'class.template.php');


$tpl = new Template;
$feuser = new FrontendUser;
$feuser->loadByPrimaryKey($auth->auth['uid']);

$Settings = array();
$Settings['viewtyp'] = "CMS_VALUE[1]";
$Settings['access_groups'] = explode(',', "CMS_VALUE[2]");
$Settings['feuser_groups'] = $feuser->getGroupsForUser();
$Settings['access'] = "0";
$Settings['feuser']['name'] = $feuser->getField('username');

if( !$Settings['viewtyp'] ) {
   // Default für alle Artikel die keine Settings haben
   $Settings['viewtyp'] = 2;
}
elseif( $Settings['viewtyp'] == 3 ) {
   // Prüfen ob der User in einer er ausgewählten Gruppen ist
   $Settings['access'] = (count( array_intersect( $Settings['feuser_groups'], $Settings['access_groups'] ) ) ? 1 : 0);
}

if(    $Settings['viewtyp'] == 2 
   OR ( $Settings['viewtyp'] == 3 AND $Settings['access'] == 1 ) ) {

##############################################
##############################################
# Hier der Reguläre CODE für die DOWNLOAD LISTE #
##############################################
##############################################


cInclude ("classes", "class.upload.php");
cInclude ("classes", "class.properties.php");
cInclude ("classes", "class.htmlelements.php");
cInclude ("includes", "functions.upl.php");

// template defined vars
$dllist_path = "CMS_VALUE[110]";
$dllist_extensions = trim("CMS_VALUE[111]");
$dllist_idart = trim("CMS_VALUE[112]");

$str_where_filetype = "";
if ( strlen ($dllist_extensions) > 0) {
   $arr_extensions = explode (",",$dllist_extensions);
   
   $arr_where = array();
   foreach ($arr_extensions as $str_extension) {
      $arr_where[] = "filetype ='" . trim($str_extension) . "'";
   }
   
   $str_where_filetype = ' ( ' . implode( " OR ", $arr_where ) . ' ) AND ';
}

// get list of all files
$dllist_collection = new UploadCollection ();
$dllist_collection->select($str_where_filetype . " dirname = '" . $dllist_path . "'","","filename ASC");

// initialize needed objects
$obj_file_properties = new PropertyCollection();
$obj_icon = new cHTMLImage();
$obj_description = new cHTMLDIV();

// reset template
$tpl = new Template();
$tpl->reset();

// add head description
$tpl->set("s","HEAD_NAME", mi18n("Dateiname") );
$tpl->set("s","HEAD_FILETYPE", mi18n("Dateityp") );
$tpl->set("s","HEAD_FILESIZE", mi18n("Grösse") );
$tpl->set("s","HEAD_COUNTER", mi18n("Downloads") );

// run file list
while ($dllist_item = $dllist_collection->next() ) {
   
   // icon for file
   $obj_icon->setSrc( uplGetFileIcon($dllist_item->get("filename")) );
   
   // file description
   $str_file_description = "";
   if (strlen($dllist_item->get("description"))> 0) {
      $obj_description->setContent($dllist_item->get("description")); 
      $obj_description->setClass("fileDescription");
      $str_file_description = $obj_description->toHTML();
   }
   
   // filename
   $str_file_name = $dllist_item->get("filename");
   $str_file_name_property = $obj_file_properties->getValue("upload", $dllist_item->get("dirname").$dllist_item->get("filename"), "file", "medianame");
   if (strlen($str_file_name_property) > 0) {
      $str_file_name = $str_file_name_property;
   }
   
   // filecounter 
   $str_file_counter = "0";
   $str_file_counter_property = $obj_file_properties->getValue("upload", $dllist_item->get("dirname").$dllist_item->get("filename"), "file", "counter");
   if ( strlen ($str_file_counter_property) > 0 ) {
      $str_file_counter = $str_file_counter_property;
   }
   
   // file url
   $str_file_url = $cfgClient[$client]["upl"]["htmlpath"] . $dllist_item->get("dirname") . $dllist_item->get("filename");
   if ( isset($dllist_idart) && !empty($dllist_idart) && (int)$dllist_idart > 0 ) {
      $str_file_url = $sess->url("front_content.php?idart=" . $dllist_idart . "&changelang=" . $lang .  "&client=" . $client . "&sse_idupl=" . $dllist_item->get("idupl") );
   }
   
   
   // fill template
   $tpl->set("d", "FILE_ICON", $obj_icon->toHTML() . '&nbsp;');
   $tpl->set("d", "FILE_NAME", $str_file_name );
   $tpl->set("d", "FILE_TYPE", $dllist_item->get("filetype") );
   $tpl->set("d", "FILE_SIZE", human_readable_size($dllist_item->get("size")) );
   $tpl->set("d", "FILE_COUNTER", $str_file_counter );
   $tpl->set("d", "FILE_DESCRIPTION", $str_file_description );
   $tpl->set("d", "FILE_URL", $str_file_url );
   
   $tpl->next();
}

// set template
$str_template_name = "download_list.html";
if ( isset($dllist_idart) && !empty($dllist_idart) && (int)$dllist_idart > 0 ) {
   $str_template_name = "download_list_counter.html";
}

// print template
print $tpl->generate($cfgClient[$client]["tpl"]["path"] . $str_template_name, 1, 0);

}
elseif( $Settings['viewtyp'] == 3 ) {
   $template = 'login1.html';

   $tpl->set('s', 'LOGIN_ACTION', 'front_content.php?idart='.$idart );
   $tpl->set('s', 'USERNAME', mi18n("username"));
   $tpl->set('s', 'PASSWORD', mi18n("password"));
   $tpl->set('s', 'LOGIN', mi18n("Login"));

   $tpl->generate('templates/'.$template );
} 

?>
login1.html

Code: Alles auswählen

<form action="{LOGIN_ACTION}" name="login_form" method="post" class="login">
   <h3 class="login">{LOGIN}</a></h3>
   <input class="name" name="username" type="text" value="{USERNAME}" onfocus="if(this.value=='{USERNAME}'){this.value=''}" onblur="if(!this.value){this.value='{USERNAME}'}" />
   <input class="pass" name="password" id="password1" type="password" value="" onblur="if(!this.value){document.getElementById('password2').style.display=''; this.style.display='none'}" style="display: none;" />
   <input class="pass" name="password2" id="password2" type="text"     value="{PASSWORD}" onfocus="if(this.value=='{PASSWORD}'){document.getElementById('password1').style.display=''; document.getElementById('password1').focus(); this.style.display='none'}" /><br><br>
   <a href="javascript:document.login_form.submit()"> <img src="gfx/submit.gif" align="absmiddle" alt="{LOGIN}"  width="16" height="17"></a>
</form>
Gruß,
ephesus
Gesperrt