コード例 #1
0
    function Joom_BuildCommentsForm_HTML($allowcomment)
    {
        $config = Joom_getConfig();
        $database =& JFactory::getDBO();
        $user =& JFactory::getUser();
        $linecolor = 0;
        if (!$allowcomment) {
            ?>
        <tr class="sectiontableentry1">
          <td class="jg_cmtf" colspan="2">
            <?php 
            echo JText::_('JGS_NO_COMMENTS_BY_GUEST');
            ?>
&nbsp;
          </td>
        </tr>
<?php 
            return;
        }
        if ($config->jg_secimages == 2 || $config->jg_secimages == 1 && $user->get('aid') < 1) {
            if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_easycaptcha' . DS . 'class.easycaptcha.php')) {
                include_once JPATH_ROOT . DS . 'components' . DS . 'com_easycaptcha' . DS . 'class.easycaptcha.php';
                $captcha = new easyCaptcha();
            } else {
                $config->jg_secimages = 0;
            }
        }
        ?>
      <a name="joomcommentform"></a>
<?php 
        $bbcodestatus = array(JText::_('JGS_BBCODE_OFF'), JText::_('JGS_BBCODE_ON'));
        if (isset($_COOKIE['sessioncookie']) && $_COOKIE['sessioncookie'] != '') {
            $cryptSessionID = md5($_COOKIE['sessioncookie']);
            $database->setQuery(" SELECT\n                              username\n                            FROM\n                              #__session\n                            WHERE\n                              session_ID = " . $cryptSessionID . "\n                          ");
            $cmtname = $database->LoadResult();
            //$cmtname = $result2->cmtname;
        }
        ?>
        <form name="commentform" action="<?php 
        echo JRoute::_($this->joom_componenturl . '&func=commentpic&id=' . $this->id . _JOOM_ITEMID);
        ?>
" target="_top" method="post">
<?php 
        if ($config->jg_secimages == 2 || $config->jg_secimages == 1 && $user->get('aid') < 1) {
            ?>
          <input type="hidden" name="jg_captcha_id" value="<?php 
            echo $captcha->getCaptchaId();
            ?>
" />
<?php 
        }
        if (!$user->get('username')) {
            $ip = $_SERVER['REMOTE_ADDR'];
            ?>
          <input type="hidden" name="cmtip" value="<?php 
            echo $ip;
            ?>
" />
<?php 
        }
        $linecolor = $linecolor % 2 + 1;
        ?>
        <tr class="sectiontableentry1">
          <td class="jg_cmtl">
            <?php 
        echo $user->get('username');
        ?>
&nbsp;
<?php 
        if ($user->get('aid') < 1) {
            if ($config->jg_namedanoncomment) {
                ?>
            <input type="text" class="inputbox" name="cmtname" value="<?php 
                echo JText::_('JGS_GUEST');
                ?>
" />
<?php 
            } else {
                ?>
            <input type="hidden" class="inputbox" name="cmtname" value="<?php 
                echo JText::_('JGS_GUEST');
                ?>
" />
<?php 
            }
        } else {
            ?>
            <input type="hidden" class="inputbox" name="cmtname" value="<?php 
            echo $user->get('username');
            ?>
" />
<?php 
        }
        if ($config->jg_smiliesupport) {
            ?>
            <div style="padding:0.4em 0;">
<?php 
            $count = 1;
            $smileys = Joom_GetSmileys();
            foreach ($smileys as $i => $sm) {
                ?>
              <a href="javascript:joom_smilie('<?php 
                echo $i;
                ?>
')" title="<?php 
                echo $i;
                ?>
">
                <img src="<?php 
                echo $sm;
                ?>
" border="0" alt="<?php 
                echo $sm;
                ?>
" /></a><?php 
                if ($count % 4 == 0) {
                    ?>
              <br />
<?php 
                }
                $count++;
            }
            ?>
            </div>
<?php 
        }
        ?>
            <p class="small">
              <?php 
        echo JText::_('JGS_BBCODE_IS');
        ?>
              <b><?php 
        echo $bbcodestatus[$config->jg_bbcodesupport];
        ?>
</b>.
            </p>
          </td>
          <td class="jg_cmtr">
<?php 
        if ($config->jg_smiliesupport) {
            $rows = 8;
        } else {
            $rows = 4;
        }
        ?>
            <p>
              <textarea cols="40" rows="<?php 
        echo $rows;
        ?>
" name="cmttext" class="inputbox" onfocus="jg_comment_active=1" onchange="jg_comment_active=0" onblur="jg_comment_active=0"></textarea>
            </p>
          </td>
        </tr>
<?php 
        if ($config->jg_secimages == 2 || $config->jg_secimages == 1 && $user->get('aid') < 1) {
            ?>
        <tr class="<?php 
            echo "sectiontableentry" . $linecolor;
            ?>
">
          <td class="jg_cmtl">
            &nbsp;
          </td>
          <td class="jg_cmtr">
            <img src="<?php 
            echo $captcha->getImageUrl();
            ?>
" alt="<?php 
            echo $captcha->getAltText();
            ?>
" border="0" id="jg_captcha_image" />
          </td>
        </tr>
<?php 
            $linecolor = $linecolor % 2 + 1;
            ?>
        <tr class="sectiontableentry1">
          <td class="jg_cmtl">
            <?php 
            echo JText::_('JGS_ENTER_CODE');
            ?>
&nbsp;
          </td>
          <td class="jg_cmtr">
            <input class="inputbox" type='text' value="" name='jg_code' />
            <?php 
            echo $captcha->getReloadButton("jg_captcha_image");
            ?>
            <?php 
            echo $captcha->getReloadCode();
            ?>
          </td>
        </tr>
<?php 
        }
        ?>
        <tr class="sectiontableentry1">
          <td class="jg_cmtl">
          </td>
          <td class="jg_cmtr">
            <p>
              <input type="button" name="send" value="<?php 
        echo JText::_('JGS_COMMENT_SEND');
        ?>
" class="button" onclick="joom_validatecomment()" />
              &nbsp;
              <input type="reset" value="<?php 
        echo JText::_('JGS_DELETE');
        ?>
" name="reset" class="button" />
            </p>
          </td>
        </tr>
        </form>
<?php 
    }
コード例 #2
0
    function Joom_ShowSpecials_HTML($tl_title, $rows, $sorting)
    {
        $config = Joom_getConfig();
        $database =& JFactory::getDBO();
        $user =& JFactory::getUser();
        $num_rows = ceil(count($rows) / $config->jg_toplistcols);
        $index = 0;
        $line = 1;
        ?>
  <div class="jg_topview">
    <div class="sectiontableheader">
      <?php 
        echo $tl_title;
        ?>
&nbsp;
    </div>
<?php 
        $count_rows = count($rows);
        if ($count_rows) {
            for ($row_count = 0; $row_count < $num_rows; $row_count++) {
                $line++;
                $linecolor = $line % 2 + 1;
                ?>
    <div class="jg_row <?php 
                if ($linecolor == 1) {
                    echo "sectiontableentry1";
                } else {
                    echo "sectiontableentry2";
                }
                ?>
">
<?php 
                for ($col_count = 0; $col_count < $config->jg_toplistcols && $index < $count_rows; $col_count++) {
                    $row1 = $rows[$index];
                    ?>
      <div class="jg_topelement">
<?php 
                    $catpath = Joom_GetCatPath($row1->catid);
                    if ($config->jg_showdetailpage == 0 && $user->get('aid') != 0 || $config->jg_showdetailpage == 1) {
                        $link = Joom_OpenImage($config->jg_detailpic_open, $row1->id, $catpath, $row1->catid, $row1->imgfilename, $row1->imgtitle, $row1->imgtext);
                    } else {
                        $link = "javascript:alert('" . JText::_('JGS_ALERT_NO_DETAILVIEW_FOR_GUESTS', true) . "')";
                    }
                    ?>
        <div  class="jg_topelem_photo">
          <a href="<?php 
                    echo $link;
                    ?>
">
            <img src="<?php 
                    echo _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $row1->imgthumbname;
                    ?>
" class="jg_photo" alt="<?php 
                    echo $row1->imgtitle;
                    ?>
" />
          </a>
        </div>
        <div class="jg_topelem_txt">
          <ul>
            <li>
              <b><?php 
                    echo $row1->imgtitle;
                    ?>
</b>
            </li>
            <li>
              <?php 
                    echo JText::_('JGS_CATEGORY') . ':';
                    ?>
              <a href="<?php 
                    echo JRoute::_('index.php?option=com_joomgallery&func=viewcategory&catid=' . $row1->catid . _JOOM_ITEMID);
                    ?>
">
                <?php 
                    echo $row1->name;
                    ?>
              </a>
            </li>
<?php 
                    if ($config->jg_showauthor) {
                        if ($row1->imgauthor) {
                            $authorowner = $row1->imgauthor;
                        } elseif ($config->jg_showowner) {
                            $authorowner = Joom_GetDisplayName($row1->owner);
                        } else {
                            $authorowner = JText::_('JGS_NO_DATA');
                        }
                        ?>
            <li>
              <?php 
                        echo JText::_('JGS_AUTHOR') . ': ' . $authorowner;
                        ?>
&nbsp;
            </li>
<?php 
                    }
                    if ($config->jg_showhits) {
                        ?>
            <li>
              <?php 
                        echo JText::_('JGS_HITS') . ': ' . $row1->imgcounter;
                        ?>
&nbsp;
            </li>
<?php 
                    }
                    if ($config->jg_showcatrate) {
                        ?>
            <li>
<?php 
                        if ($row1->imgvotes > 0) {
                            $fimgvotesum = number_format($row1->imgvotesum / $row1->imgvotes, 2, ',', '');
                            if ($row1->imgvotes == 1) {
                                $frating = $fimgvotesum . ' (' . $row1->imgvotes . ' ' . JText::_('JGS_ONE_VOTE') . ')';
                            } else {
                                $frating = $fimgvotesum . ' (' . $row1->imgvotes . ' ' . JText::_('JGS_VOTES') . ')';
                            }
                        } else {
                            $frating = '(' . JText::_('JGS_NO_RATINGS') . ')';
                        }
                        ?>
              <?php 
                        echo JText::_('JGS_RATING') . ': ' . $frating;
                        ?>
            </li>
<?php 
                    }
                    if ($config->jg_showcatcom) {
                        # Check how many comments exist
                        $database->setQuery(" SELECT \n                                    COUNT(*)\n                                  FROM \n                                    #__joomgallery_comments\n                                  WHERE \n                                           cmtpic = '{$row1->id}' \n                                    AND approved  = '1' \n                                    AND published = '1'\n                                ");
                        $comments = $database->LoadResult();
                        ?>
            <li>
<?php 
                        switch ($comments) {
                            case 0:
                                ?>
              <?php 
                                echo JText::_('JGS_NO_COMMENTS');
                                ?>
&nbsp;
<?php 
                                break;
                            case 1:
                                ?>
              <?php 
                                echo $comments . ' ' . JText::_('JGS_COMMENT');
                                ?>
&nbsp;
<?php 
                                break;
                            default:
                                ?>
              <?php 
                                echo $comments . ' ' . JText::_('JGS_COMMENTS');
                                ?>
&nbsp;
<?php 
                                break;
                        }
                        ?>
            </li>
<?php 
                        if ($sorting == 'lastcomment' && $config->jg_showthiscomment) {
                            for ($ii = 0; $ii < $comments; $ii++) {
                                $userid = $row1->userid;
                                $cmtname = $row1->cmtname;
                                if ($userid > 0) {
                                    $cmtname = $row1->username;
                                }
                                $cmttext = $row1->cmttext;
                                $cmtdate = $row1->cmtdate;
                                #$cmtdate = strftime( "%d-%m-%Y %H:%M:%S", $cmtdate );
                                $cmtdate = strftime($config->jg_dateformat, $cmtdate);
                            }
                            ?>
            <li>
<?php 
                            if ($userid > 0) {
                                ?>
			        <?php 
                                echo Joom_GetDisplayName($userid, false);
                            } else {
                                echo $cmtname;
                            }
                            echo ' ' . JText::_('JGS_WROTE') . ' (' . JText::_('JGS_AT') . ' ' . $cmtdate . '):';
                            $cmttext = Joom_ProcessText($cmttext);
                            if ($config->jg_smiliesupport) {
                                $smileys = Joom_GetSmileys();
                                foreach ($smileys as $i => $sm) {
                                    $cmttext = str_replace($i, '<img src="' . $sm . '" border="0" alt="' . $i . '" title="' . $i . '" />', $cmttext);
                                }
                            }
                            ?>
              <?php 
                            echo stripslashes($cmttext);
                            ?>
&nbsp;
            </li>
<?php 
                        }
                    }
                    ?>
          </ul>
        </div>
      </div>
<?php 
                    $index++;
                }
                ?>
      <div class="jg_clearboth"></div>
    </div>
<?php 
            }
        }
        ?>
  </div>
<?php 
    }