Beispiel #1
0
 /**
  * Copies the static files (stylesheets etc.) into the export
  */
 private function copy_static_files()
 {
     require_once 'file.php';
     $staticdir = $this->get('exportdir') . '/' . $this->get('rootdir') . '/static/';
     $directoriestocopy = array();
     // Get static directories from each theme for HTML export
     $themestaticdirs = theme_get_path('', 'export/html/', true);
     foreach ($themestaticdirs as $theme => $dir) {
         $themedir = $staticdir . 'theme/' . $theme . '/static/';
         $directoriestocopy[$dir] = $themedir;
         if (!check_dir_exists($themedir)) {
             throw new SystemException("Could not create theme directory for theme {$theme}");
         }
     }
     // Smilies
     $directoriestocopy[get_config('docroot') . 'js/tinymce/plugins/emotions/images'] = $staticdir . 'smilies/';
     $filestocopy = array(get_config('docroot') . 'theme/views.css' => $staticdir . 'views.css');
     foreach ($this->pluginstaticdirs as $dir) {
         $destinationdir = str_replace('export/html/', '', $dir);
         if (!check_dir_exists($staticdir . $destinationdir)) {
             throw new SystemException("Could not create static directory {$destinationdir}");
         }
         $directoriestocopy[get_config('docroot') . 'artefact/' . $dir] = $staticdir . $destinationdir;
     }
     foreach ($directoriestocopy as $from => $to) {
         if (!copyr($from, $to)) {
             throw new SystemException("Could not copy {$from} to {$to}");
         }
     }
     foreach ($filestocopy as $from => $to) {
         if (!copy($from, $to)) {
             throw new SystemException("Could not copy static file {$from}");
         }
     }
 }
Beispiel #2
0
        // blocktype
        $ap = param_alpha('ap', null);
        // artefact plugin (optional)
        $basepath = 'blocktype/' . $bt;
        if (!empty($ap)) {
            $basepath = 'artefact/' . $ap . '/' . $basepath;
        }
        header('Content-type: image/png');
        $maxage = 604800;
        header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $maxage) . ' GMT');
        header('Cache-Control: max-age=' . $maxage);
        header('Pragma: public');
        $path = get_config('docroot') . $basepath . '/thumb.png';
        if (is_readable($path)) {
            readfile($path);
            exit;
        }
        readfile(theme_get_path('images/no_thumbnail.png'));
        break;
    case 'viewlayout':
        header('Content-type: image/png');
        $vl = param_integer('vl');
        if ($widths = get_field('view_layout', 'widths', 'id', $vl)) {
            if ($path = theme_get_path('images/vl-' . str_replace(',', '-', $widths) . '.png')) {
                readfile($path);
                exit;
            }
        }
        readfile(theme_get_path('images/no_thumbnail.png'));
        break;
}
Beispiel #3
0
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    mahara
 * @subpackage core
 * @author     Catalyst IT Ltd
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
 *
 */
define('INTERNAL', 1);
define('PUBLIC', 1);
require 'init.php';
$name = param_alphanumext('name', 'captcha');
// Get 5 random letters.
$code = get_random_key(5);
$angles = array(40, 0, 340, 20, 310);
$lefts = array(30, 50, 70, 95, 110);
$bottoms = array(24, 20, 28, 34, 33);
$file = theme_get_path('images/captcha.png');
$img = imagecreatefrompng($file);
$black = imagecolorallocate($img, 60, 60, 60);
$ttf = theme_get_path('captcha.ttf');
$captcha = '';
for ($i = 0; $i < strlen($code); $i++) {
    imagettftext($img, 18, $angles[$i], $lefts[$i], $bottoms[$i], $black, $ttf, $code[$i]);
    $captcha .= $code[$i];
}
$SESSION->set($name, $captcha);
header('Content-type: image/png');
imagepng($img);