示例#1
0
 function addAlbum()
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     $this->load->library('upload');
     $this->load->helper('inflector');
     $post = $this->input->post();
     $title = $post['title'];
     $year = $post['year'];
     $description = $post['description'];
     $slug = str_replace(' ', '-', strtolower($title));
     preprint($post);
     $path = './assets/uploads/album/' . $slug . '/';
     if (!is_dir($path)) {
         mkdir($path, 0755, TRUE);
     } else {
         redirect('/cms_gallery/fotogalleri?addalbum=error');
     }
     $config['upload_path'] = $path;
     $config['allowed_types'] = 'gif|jpg|png';
     $config['file_name'] = 'cover_image';
     $this->upload->initialize($config);
     if (!$this->upload->do_upload()) {
         redirect('/cms_gallery/fotogalleri?upload=error');
     }
     $fileinfo = $this->upload->data();
     preprint($fileinfo);
     $ext = $fileinfo['file_ext'];
     $this->album->create($title, $year, $description, $slug, $ext);
     redirect('/cms_gallery/fotogalleri?upload=success');
 }
示例#2
0
function send_mail($to, $thm, $html, $from = MAIL_FROM, $file_path = false, $send_name = 'default.txt')
{
    $headers = "";
    $multipart = "";
    if ($file_path) {
        $fp = fopen($file_path, "r");
        if (!$fp) {
            preprint("Файл " . $file_path . " не может быть прочитан");
            return false;
        }
        $file = fread($fp, filesize($file_path));
        fclose($fp);
    }
    $boundary = "--" . md5(uniqid(time()));
    // генерируем разделитель
    $headers .= "From: " . $from . "\n";
    $headers .= "Reply-To: " . $from . "\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: multipart/mixed; boundary=\"" . $boundary . "\"\n";
    $multipart .= "--" . $boundary . "\n";
    $kod = 'utf-8';
    $multipart .= "Content-Type: text/html; charset=" . $kod . "\n";
    $multipart .= "Content-Transfer-Encoding: Quot-Printed\n\n";
    $multipart .= $html . "\n\n";
    if ($file_path) {
        $message_part = "--" . $boundary . "\n";
        $message_part .= "Content-Type: application/octet-stream\n";
        $message_part .= "Content-Transfer-Encoding: base64\n";
        $message_part .= "Content-Disposition: attachment; filename = \"" . $send_name . "\"\n\n";
        $message_part .= chunk_split(base64_encode($file)) . "\n";
        $multipart .= $message_part;
    }
    $multipart .= "--" . $boundary . "--\n";
    if (!mail($to, mime_header_encode($thm, "utf-8", "utf-8"), $multipart, $headers)) {
        preprint("Письмо не отправлено.");
        return false;
    } else {
        return true;
    }
}
示例#3
0
* 
*/
function preprint($val)
{
    echo "<pre>\n";
    print_r($val);
    echo "</pre>\n";
}
error_reporting(E_ALL);
require_once 'Savant2.php';
$conf = array('template_path' => 'templates', 'resource_path' => 'resources');
$savant = new Savant2($conf);
echo "<h1>Paths to begin with</h1>\n";
preprint($savant->getPath('resource'));
preprint($savant->getPath('template'));
echo "<h1>Add a path</h1>\n";
$savant->addPath('resource', 'no/such/path');
preprint($savant->getPath('resource'));
echo "<h1>Find an existing resource (non-default)</h1>\n";
$file = $savant->findFile('resource', 'Savant2_Plugin_cycle.php');
preprint($file);
echo "<h1>Find an existing resource (default)</h1>\n";
$file = $savant->findFile('resource', 'Savant2_Plugin_input.php');
preprint($file);
echo "<h1>Find a non-existent template</h1>\n";
$file = $savant->findFile('template', 'no_such_template.tpl.php');
if ($file) {
    preprint($file);
} else {
    preprint("false or null");
}
示例#4
0
 function deleteAccount($id)
 {
     session_unset();
     session_destroy();
     $info = $this->db->query("SELECT * FROM people WHERE id = '" . $id . "'")->row_array();
     preprint($info);
     $this->db->query("DELETE FROM cms_access WHERE email = '" . $info['email'] . "'");
     $this->db->query("DELETE FROM people WHERE email = '" . $info['email'] . "'");
     $this->db->query("DELETE FROM cms_teachers WHERE email = '" . $info['email'] . "'");
     redirect("/");
 }
    /**
     * Display main options page structure
     *
     * @return AdobeEdgeFonts
     */
    public function aef_display()
    {
        if (!current_user_can('manage_options')) {
            return;
        }
        ?>
    
        <div class="wrap">
            <div id="icon-faq-admin" class="icon32"><br /></div>
            <h2><?php 
        _e('Adobe Edge WebFonts');
        ?>
</h2>

            <?php 
        if (isset($_GET['settings-updated'])) {
            echo '<div id="message" class="updated below-h2"><p>Font selections updated successfully.</p></div>';
        }
        ?>

            <div id="poststuff" class="metabox-holder has-right-sidebar">

            <?php 
        echo $this->settings_side();
        echo $this->settings_open();
        ?>
                
            <form method="post" action="options.php" class="aef-settings-form">

                <?php 
        settings_fields('aef-settings');
        $options = get_option('aef-settings');
        $fonts = $this->fonts();
        ?>


                <h2 class="inst-title"><?php 
        _e('Available Fonts');
        ?>
</h2>
                <p class="font-choice">
                    <select name="aef-settings[]" class="font-choices chzn-select" style="width:350px;" multiple data-placeholder="Select a font...">
                    <?php 
        foreach ($fonts as $name => $display) {
            echo '<option id="' . $name . '" value="' . $name . '">' . $display . '</option>';
        }
        ?>
                    </select>
                    <label type="select" for="aef-settings[]"><?php 
        _e('Select A Font');
        ?>
</label>
                </p>         

                <!-- submit -->
                <p id="aef-submit" class="font-submit"><input type="submit" class="button-primary font-submit" value="<?php 
        _e('Save Changes');
        ?>
" /></p>

                </form>

                <div id="aef-selected">
                   <?php 
        echo preprint($options);
        ?>
 
                </div>

    <?php 
        echo $this->settings_close();
        ?>

    </div>
    </div>   
    
    <?php 
    }
示例#6
0
				<div class="bread">Email</div>
				<div class="crumbs"><?php 
echo $user['email'];
?>
</div>
				<div class="bread">Telefonnumer</div>
				<div class="crumbs"><?php 
echo $user['phone'];
?>
</div>
				<div class="bread">Stilar</div>
				<div class="crumbs">
					<ul>
						<?php 
$split = explode(', ', $user['class']);
preprint($split);
foreach ($split as $splat) {
    $q = $this->db->query("SELECT style FROM cms_coursesinfo WHERE id = '" . $splat . "'")->row_array();
    echo '<li>' . @$q['style'] . '</li>';
}
?>
					</ul>
				</div>
			</div>
			<div class="right-box">
				Jag är en kvalificerad diplomerad danslärare med 14 års erfarenhet och arbetar med barn och ungdomar från 3 år till 20 år med undervisning i  barndans, streetdance, showdans, barnbalett.
				<br /><br />
				- utbildad vid Modern Dance Company, studerat vid Balettakademin i Norrköping och Stockholm - har genomgått olika kurser arrangerat av Svenska Danspedagogförbundet bl. a under ledning av Ivo Cramèr. <br />
				- har varit verksam som danspedagog i Sverige sedan 1993 och blev diplomerad av Svenska Danspedagogförbundet 2001.<br />
				- fick ungdomsledarstipendium som utdelas av Stockholms Idrottsförvaltningen år 2002. <br />
				- fick ungdomskulturstipendiet ”Kossans barn” av Boo Folkets Hus 2003.<br />
示例#7
0
 function courseApplied($var)
 {
     $this->load->model(array('courseinfo', 'check'));
     preprint($_POST);
     exit;
     $firstname = $_POST['firstname'];
     $lastname = $_POST['lastname'];
     $bnumber = $_POST['birthnumb'];
     $email = $_POST['email'];
     $phone = $_POST['phone'];
     $classes = $var;
     /**
      * Check if input email already exists in database
      */
     if ($this->check->mail($email) == TRUE) {
         $getINFO = $this->check->mail($email);
         $old_classes = $getINFO['classes'];
         $id = $getINFO['id'];
         $newclass = $old_classes . ', ' . $classes;
         $split_classes = explode(', ', $old_classes);
         /**
          * If it exists, check classes. Is the course already set on the student?
          */
         if (in_array($var, $split_classes)) {
             redirect('/apply?error=exists');
         }
         /**
          * If student has no classes, just add new one.
          */
         if (empty($old_classes)) {
             $newclass = $classes;
         }
         /**
          * If student had an older class set but adds a new one on top of that.
          */
         $this->db->query("UPDATE students SET classes = '" . $newclass . "' WHERE id = '" . $id . "'");
     } else {
         /**
          * If the email is not recognized, create a new student and add course information.
          */
         $this->db->query("INSERT INTO students\r\n\t\t\t(firstname, lastname, birthnumber, email, phone, classes) VALUES\r\n\t\t\t('{$firstname}', '{$lastname}', '{$bnumber}', '{$email}', '{$phone}', '{$classes}')");
         $this->db->query("INSERT INTO cms_access (email) VALUES ('{$email}')");
     }
 }
示例#8
0
// and tell Savant to use it.
$savant->setCompiler($compiler);
// set up vars
$array = array('key0' => 'val0', 'key1' => 'val1', 'key2' => 'val2');
$var1 = 'variable1';
$var2 = 'variable2';
$var3 = 'variable3';
$ref1 = 'reference1';
$ref2 = 'reference2';
$ref3 = 'reference3';
// assign vars
$savant->assign($var1, $var1);
$savant->assign($var2, $var2);
$savant->assign($var3, $var3);
// assigns $array to a variable $set
$savant->assign('set', $array);
// assigns the keys and values of array
$savant->assign($array);
// assign references
$savant->assignRef($ref1, $ref1);
$savant->assignRef($ref2, $ref2);
$savant->assignRef($ref3, $ref3);
echo "<h1>The 'good' template</h1>";
$compiler->strict = false;
$result = $savant->display('compile.tpl.php');
preprint($result);
echo "<h1>The 'bad' template</h1>";
$compiler->strict = true;
$result = $savant->display('compile_bad.tpl.php');
preprint($result);