Exemplo n.º 1
0
        /** Explode all fields by the line separator */
        $fields = preg_split('!\\n----\\s*\\n*!', $content);
        /** Loop through all fields */
        foreach ($fields as $field) {
            $pos = strpos($field, ':');
            $key = trim(substr($field, 0, $pos));
            /** Don't add fields with empty keys */
            if (empty($key)) {
                continue;
            }
            $posts_tmp[$i][$key] = trim(substr($field, $pos + 1));
        }
        $posts_tmp[$i]['file_name'] = substr($file, 0, -3);
        //$posts_tmp[$i]['size'] = ceil(filesize($archive_folder . DS . $file)/1024);
        fclose($handle);
    }
    $i++;
}
$posts = sortArrayByFields($posts_tmp, array('id' => SORT_DESC));
if (!$found) {
    $is_404 = true;
    get_404();
}
require_once ABSPATH . 'includes' . DS . 'themes' . DS . $theme_directory . DS . 'archive.php';
if ($cache) {
    $cache_content = html_trim(ob_get_clean());
    $handle = fopen($cache_file, 'w');
    fwrite($handle, $cache_content);
    fclose($handle);
    echo $cache_content;
}
Exemplo n.º 2
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     // add miscellaneous vars to the template
     $this->addTemplateVars();
     // get href for the detail-page
     $objDetailPage = \PageModel::findWithDetails($this->detailPage);
     if ($objDetailPage === NULL) {
         $href = NULL;
     } else {
         $href = $this->generateFrontendUrl($objDetailPage->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/member/%s', $objDetailPage->language);
     }
     $objMember = $this->Database->prepare('SELECT * FROM tl_member WHERE disable = ?')->execute(0);
     $arrRows = array();
     while ($row = $objMember->fetchAssoc()) {
         foreach ($row as $k => $v) {
             if ($k == 'id' || $k == 'tstamp' || $k == 'password' || $k == 'avatar') {
                 continue;
             }
             $row[$k] = $v;
         }
         // score and grade
         $row['score'] = $this->getScore($row['id']);
         $row['averageRating'] = $this->getAverageRating($row['id']);
         $row['ratingEnities'] = $this->getRatingEnities($row['id']);
         $row['gradeLabel'] = $this->getGrade($row['id'], 'label');
         $row['gradeIcon'] = $this->getGrade($row['id'], 'label');
         // link to detail page
         $row['hrefDetailPage'] = $href ? sprintf($href, $row['id']) : false;
         // get avatar of member
         $arrSize = deserialize($this->avatarSizeListing);
         $title = $row['firstname'] . ' ' . $row['lastname'];
         $row['avatar'] = $this->getAvatar($objMember->id, $arrSize, 'avatar', $title, 'avatar_thumb', $this);
         // Show only Members from a selected group
         if ($this->limitUsers) {
             $arrGroups = deserialize($this->listedGroups);
             $oMember = \MemberModel::findByPk($objMember->id);
             if ($oMember !== null) {
                 if (count(array_intersect(deserialize($oMember->groups), $arrGroups)) < 1) {
                     continue;
                 }
             }
         }
         $arrRows[] = $row;
     }
     // Sorting
     $arrSorting = array();
     if (!empty($this->sortingField1) && !empty($this->sortingDirection1)) {
         $arrSorting[$this->sortingField1] = constant($this->sortingDirection1);
     }
     if (!empty($this->sortingField2) && !empty($this->sortingDirection2)) {
         $arrSorting[$this->sortingField2] = constant($this->sortingDirection2);
     }
     if (!empty($this->sortingField3) && !empty($this->sortingDirection3)) {
         $arrSorting[$this->sortingField3] = constant($this->sortingDirection3);
     }
     $arrRows = sortArrayByFields($arrRows, $arrSorting);
     $this->Template->rows = count($arrRows) ? $arrRows : false;
 }