Exemplo n.º 1
0
function _generic_page($params)
{
    global $lex, $lang, $page;
    $db = connect_database();
    //
    $content = $db->query('SELECT title, content FROM content WHERE lang = \'' . $lang . '\' AND slug = \'' . str_replace('_', '-', $page) . '\'');
    if ($data = row_assoc($content)) {
    } else {
        $data = array('title' => $lex['not-found'], 'content' => '<p>' . $lex['translation-not-found'] . '</p>');
    }
    //
    $data['page'] = $page;
    $data['html_head'] = array('title' => $data['title'], 'description' => shorten_string($data['title'], 250));
    return $data;
}
Exemplo n.º 2
0
        echo $article['id'];
        ?>
/<?php 
        echo slugify($article['title']);
        ?>
">
			<small><?php 
        echo beautify_datetime($article['published']);
        ?>
</small>
			<h3><?php 
        echo $article['title'];
        ?>
</h3>
			<p><?php 
        echo shorten_string($article['content'], 250);
        ?>
</p>
		</a>
	</li>
<?php 
    }
    ?>
</ul>

<?php 
    if ($pages > 1) {
        for ($i = 1; $i < $pages + 1; $i++) {
            ?>
<a class="button<?php 
            echo $i == $page ? ' current' : '';
Exemplo n.º 3
0
             if (!$features['enum_main']) {
             } else {
                 $record[$field_name] = $features['enum_main'][$record[$field_name]];
             }
         } else {
             if ($features['enum']) {
                 $record[$field_name] = $features['enum'][$record[$field_name]];
             }
         }
     }
 }
 if ($features['main_preg_replace']) {
     $record[$field_name] = preg_replace($features['main_preg_replace'][0], $features['main_preg_replace'][1], $record[$field_name]);
 }
 if ($features['main_trim']) {
     $record[$field_name] = shorten_string($record[$field_name], $features['main_trim']);
 }
 if ($features['main_trim_crop']) {
     if (strlen($record[$field_name]) > $features['main_trim_crop']) {
         $record[$field_name] = substr($record[$field_name], 0, $features['main_trim_crop']);
     }
 }
 if ($features['main_trim_crop2']) {
     if (strlen($record[$field_name]) > $features['main_trim_crop2']) {
         $record[$field_name] = trim(substr($record[$field_name], 0, $features['main_trim_crop2'])) . "...";
     }
 }
 if ($features['main_crop_right']) {
     $record[$field_name] = substr($record[$field_name], -$features['main_crop_right']);
 }
 if ($features['main_set']) {
Exemplo n.º 4
0
" /><?php 
        if (is_image($_file->fileNewName)) {
            ?>
</a><?php 
        }
        ?>
</td>
			<td><?php 
        if ($user->userCanDownload == '1') {
            ?>
<a href="<?php 
            echo site_url($user->userURL . '/download/' . $_file->fileUniqueID);
            ?>
"><?php 
        }
        echo shorten_string($_file->fileName);
        if ($user->userCanDownload == '1') {
            ?>
</a><?php 
        }
        if (!empty($_file->fileMD5)) {
            ?>
<br /><span class="md5">MD5: <?php 
            echo $_file->fileMD5;
            ?>
</span><?php 
        }
        ?>
</td>
			<td><?php 
        echo roundsize($_file->fileSize);
Exemplo n.º 5
0
function discussion_create($options)
{
    /* Required info 
    			title
    			author
    			discussion_type
    			
    			category (A tag label)
    			Optional info
    			timestamp
    			owner (Mainly for group-discussions where the group owns the discussion and the user id is stored as author)
    			handle (This will be generated from the title if omitted)
    			parent_discussion
    			tags (Must be an array)
    			desired_quality (range -1 to +1)
    		*/
    $category = tag_exists($options['category']);
    if ($category['status'] != 'exists') {
        $category['id'] = 0;
    } else {
        $options['tags'][] = $options['category'];
    }
    $handle = isset($options['handle']) ? $options['handle'] : discussions_create_handle($options['title']);
    $timestamp = isset($options['timestamp']) ? $options['timestamp'] : time();
    $title = htmlspecialchars(shorten_string($options['title']));
    $query = 'INSERT INTO discussions (timestamp, author, owner, title, handle, discussion_type, parent_discussion, category_tag, desired_quality)';
    $query .= ' VALUES("' . $timestamp . '", "' . $options['author'] . '", "' . $options['owner'] . '", "' . $options['title'] . '"';
    $query .= ', "' . $handle . '", "' . $options['discussion_type'] . '", "' . $options['parent_discussion'] . '", "' . $category['id'] . '", "' . $options['desired_quality'] . '")';
    mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    $discussion_id = mysql_insert_id();
    tag_set_wrap(array('tag_label' => $options['tags'], 'object_type' => 'discussion', 'item_id' => $discussion_id));
    unset($return);
    $return['id'] = $discussion_id;
    $return['handle'] = $handle;
    $return['category_handle'] = $category['handle'];
    return $return;
}
Exemplo n.º 6
0
" /><?php 
        if (is_image($file->fileNewName)) {
            ?>
</a><?php 
        }
        ?>
</td>
					<td>
						<a href="<?php 
        echo site_url('admin/files/details?entry=' . $file->fileUniqueID);
        ?>
" data-file-id="<?php 
        echo $file->fileUniqueID;
        ?>
"><?php 
        echo shorten_string($file->fileName, 40);
        ?>
</a> 
						<div class="buttonline">
							<a href="<?php 
        echo site_url('admin/files/download/' . $file->fileUniqueID);
        ?>
" class="btn btn-mini icon-cloud-download"></a> 
							<a href="javascript:void(0);" data-toggle="modal" data-name="<?php 
        echo $file->fileName;
        ?>
" data-id="<?php 
        echo $file->fileUniqueID;
        ?>
" class="btn btn-mini icon-pencil rename"></a>
							<a href="#" class="btn btn-mini icon-trash trash" data-id="<?php 
Exemplo n.º 7
0
                echo "<a rel='gallery_{$gallery_rand}' class='post_img' href='get_file.php?type=images_general&id={$img_row->id}'><img style='margin: 5px;' src='get_file.php?type=images_general&id={$img_row->id}&thumbnail=true' height='50'/></a>";
            }
            echo "</fieldset>";
            echo "<script type='text/javascript'>\n\t\t\t\t\t\$('.post_img').fancybox({\n\t\t\t\t\t\topenEffect\t: 'elastic',\n\t\t\t\t\t\tcloseEffect\t: 'elastic',\n\t\t\t\t\t\ttype : 'image',\n\t\t\t\t\t\tpadding : 5,\n\t\t\t\t\t\thelpers : { title : { type : 'outside' } }\n\t\t\t\t\t});\n\t\t\t\t\t</script>";
        }
        if (mysql_num_rows($music_query) > 0) {
            echo "<fieldset style='display: inline-block;'><legend>" . translate("Music", "Nhạc") . "</legend>";
            while ($music = mysql_fetch_object($music_query)) {
                echo "<div style='clear: both;'><div id='audioplayer_{$comment->id}{$music->id}'></div><script type='text/javascript'> AudioPlayer.embed('audioplayer_{$comment->id}{$music->id}', {soundFile: \"" . $music->file_location . "\", autostart: \"no\"}); </script><div><img src='files/site_images/layout/music-16.png' style='vertical-align: middle;'/>&nbsp;<a href='get_file.php?type=music_general&id={$music->id}'>" . translate("Click here to download this music file", "Bấm đây để tải tư liệu nhạc này") . "...</a></div></div>";
            }
            echo "</fieldset>";
        }
        echo "<div id=\"discussion{$comment->id}body\" style=\"text-align: left; padding: 5px; clear: both;\">{$comment->body}</div>";
        echo "<div id=\"discussion{$comment->id}link_to_this\" style=\"clear: both;\"><img src=\"files/site_images/layout/link-16.png\" style=\"vertical-align: middle;\"/><span style=\"vertical-align: middle;\">&nbsp;";
        echo translate("Link to this discussion", "Liên kết tới bài này") . ":&nbsp;";
        echo "<input id=\"discussion{$comment->id}link_code\" style=\"margin: 0; font-size: 0.8em; font-family: monospace;\" value=\"!l[{$comment->id}:::" . shorten_string($comment->title, 5) . "]\" readonly=\"readonly\"/>";
        echo "<script type=\"text/javascript\">\n\t\t\t\t\t\$('#discussion{$comment->id}link_code').click(function(){\n\t\t\t\t\t\t\$(this).select();\n\t\t\t\t\t});\n\t\t\t\t\t\$(function(){\n\t\t\t\t\t\tvar link_input = \$('#discussion{$comment->id}link_code');\n\t\t\t\t\t\tlink_input.attr('size',link_input.val().length);\n\t\t\t\t\t\tlink_input.qtip({\n\t\t\t\t\t\t\tcontent: { text: '" . translate("Copy this line into your discussion body to create a link to this post", "Chép hàng này vào nội dung bài để tạo liên kết đến bài này") . ".' },\n\t\t\t\t\t\t\tposition: { my: 'bottom center', at: 'top center' }\n\t\t\t\t\t\t})\n\t\t\t\t\t});\n\t\t\t\t</script>";
        echo "</span></div>";
        ?>
				<div style="font-size: 0.9em;">
					<fieldset>
						<legend><?php 
        echo translate("User read status", "Thành viên đã đọc qua bài");
        ?>
</legend>
						<span style="display: inline-block; float: left; font-size: 0.8em;">
						<?php 
        $user_q = mysql_query("SELECT * FROM `users` WHERE `active` = '1'");
        $read_status_array = array();
        $reader_count = 0;
        while ($u = mysql_fetch_object($user_q)) {
Exemplo n.º 8
0
        		Place: <input type="text" id="place" name="place" value="<? if(isset($place)) echo $place; ?>"> <br /><br />
        		<input type="submit" value="Submit"><br /><br />
        		</form>*/
        //header("Location: ../index.php?l=soc_albums");
    }
} else {
    if (isset($_POST['name'])) {
        $name = $_POST['name'];
        //$description = $_POST['description'];
        $time = $_POST['time'];
        $place = $_POST['place'];
        //no point I think
        if (!empty($_POST['description'])) {
            $description = $_POST['description'];
        } else {
            $description = shorten_string($description, 50);
        }
        // CHECKING INPUT DATA :::::::
        // check if title is empty
        if (empty($name)) {
            $name_not_empty = FALSE;
        }
        // check is title is valid < 140 chars
        if (strlen($name) > 100) {
            $name_valid = FALSE;
        }
        //privacy_level is empty
        if (empty($description_not_empty)) {
            $description_not_empty = FALSE;
        }
        //time is empty
Exemplo n.º 9
0
" /><?php 
            if (is_image($file->fileNewName)) {
                ?>
</a><?php 
            }
            ?>
</td>
				<td>
					<a href="<?php 
            echo site_url('admin/files/details?entry=' . $file->fileUniqueID);
            ?>
" data-file-id="<?php 
            echo $file->fileUniqueID;
            ?>
"><?php 
            echo shorten_string(stripslashes($file->fileName), 80);
            ?>
</a>  
					<div class="buttonline">
						<a href="<?php 
            echo site_url('admin/files/download/' . $file->fileUniqueID);
            ?>
" class="btn btn-mini icon-cloud-download"></a> 
						<a href="javascript:void(0);" data-toggle="modal" class="btn btn-mini icon-pencil rename" data-name="<?php 
            echo $file->fileName;
            ?>
" data-id="<?php 
            echo $file->fileUniqueID;
            ?>
"></a> 
						<a href="#" class="btn btn-mini icon-trash trash" data-id="<?php 
Exemplo n.º 10
0
" style="display: inline-block; font-size: 0.75em; vertical-align: middle;"><?php 
    echo $post->id;
    ?>
</span>
		<span id="postline_userpost<?php 
    echo $post->id;
    ?>
" style="display: inline-block; width: 10px; height: 10px; background-color: #<?php 
    echo $post->qd_author->color;
    ?>
; margin: auto; vertical-align: middle;"></span>
		<span style="display: inline-block; vertical-align: middle; font-size: 0.8em; vertical-align: middle;"><a onClick="javascript: load_page('view_single_discussion.php?id=<?php 
    echo $post->id;
    ?>
');"><?php 
    echo empty($post->title) ? translate("No title", "Không chủ đề") : shorten_string($post->title, 5);
    ?>
</a></span>
		<?php 
    if ($numComments > 0) {
        ?>
		<span id="postline_comments<?php 
        echo $post->id;
        ?>
" style="vertical-align: middle;"><span style="font-size: 0.8em; vertical-align: middle;"><?php 
        echo $numComments;
        ?>
</span> <img src="files/site_images/layout/comment-16.png" style="vertical-align: middle;"/></span>
		<?php 
    }
    ?>
Exemplo n.º 11
0
        continue;
    }
    $show = false;
    $user_read_status = mysql_query("SELECT `{$user->username}` FROM `quick_discussions_read_status` WHERE `postid` = '{$r->id}' AND `{$user->username}` > '1970-01-01 00:00:00'");
    if (mysql_num_rows($user_read_status) == 0) {
        $show = true;
    } else {
        $a = mysql_fetch_object($user_read_status);
        if (strtotime($a->{$user->username}) < strtotime($r->last_touched)) {
            $show = true;
        }
    }
    if ($show === true) {
        $item_id = $item->parent_id == 0 ? $item->id : $item->parent_id;
        echo "<div style=\"vertical-align: middle;\"><img src=\"" . ($item->parent_id == 0 ? "files/site_images/layout/discussion-16.png" : "files/site_images/layout/comment-16.png") . "\" style=\"vertical-align: middle;\"/>";
        echo "<span style=\"vertical-align: middle;\"> <a onClick=\"javascript: load_page('view_single_discussion.php?id={$item_id}');\">" . (!empty($item->title) ? $item->title : shorten_string(strip_tags($item->body), 5)) . "</a></span>";
        echo "</div>";
        if ($item->parent_id == 0) {
            $parents_already_shown[] = $item->id;
        } else {
            $parents_already_shown[] = $item->parent_id;
        }
        $count++;
    }
}
if ($count == 0) {
    echo "<div><em>" . translate("No unread post found in the last {$months_back} month" . ($months_back > 1 ? "s" : ""), "Không bài nào chưa đọc trong {$months_back} tháng qua") . "</em></div>";
}
?>
	</div>
<?php 
Exemplo n.º 12
0
/**
 * smspromote (german provider for sending paid SMS)
 * 
 * @param unknown $param
 * @return Ambigous <string>
 */
function churchdb_smspromote($param)
{
    global $config, $user;
    $url = "https://gateway.smspromote.de";
    // Gateway URL
    // $url = "https://gateway.smspromote.de/bulk/";
    $request = "";
    $param["key"] = $config["churchdb_smspromote_apikey"];
    // Gateway Key
    $param["route"] = "gold";
    // use of Goldroute
    // $param["route"] = "basic";// use of Basicroute
    $param["debug"] = "0";
    // SMS will not be send - Testmode
    $param["message"] = utf8_decode($param["message"]);
    foreach ($param as $key => $val) {
        $request .= $key . "=" . urlencode($val) . "&";
    }
    /********************************************************
     * through file, Problem, allow_url_fopen=on needed!
     * // send SMS
     * $response = @file($url."?".$request); // send request
     * $response_code = intval($response[0]); // read response code
     ********************************************************/
    /**
     * Through FSOCKOPEN, SSL DON'T WORKS, DOES IT?
     */
    //
    // prepare connection
    $host = "gateway.smspromote.de";
    $script = "/";
    $request_length = strlen($request);
    $method = "POST";
    // generate HTTP Header, currently use 1.0 to prevent chunked
    $header = "{$method} {$script} HTTP/1.0\r\n";
    $header .= "Host: {$host}\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: {$request_length}\r\n";
    $header .= "Connection: close\r\n\r\n";
    $header .= "{$request}\r\n";
    // open connection
    $socket = @fsockopen($host, 80, $errno, $errstr);
    if ($socket) {
        fputs($socket, $header);
        // send Header
        while (!feof($socket)) {
            $output[] = fgets($socket);
            // get Response
        }
        fclose($socket);
    }
    $response_code = intval($output[count($output) - 1]);
    $response_code_arr = array();
    $response_code_arr[0] = "Keine Verbindung zum Gateway";
    $response_code_arr[10] = "Empfänger fehlerhaft";
    $response_code_arr[20] = "Absenderkennung zu lang";
    $response_code_arr[30] = "Nachrichtentext zu lang";
    $response_code_arr[31] = "Messagetyp nicht korrekt";
    $response_code_arr[40] = "Falscher SMS-Typ";
    $response_code_arr[50] = "Fehler bei Login";
    $response_code_arr[60] = "Guthaben zu gering";
    $response_code_arr[70] = "Netz wird von Route nicht unterstützt";
    $response_code_arr[71] = "Feature nicht über diese Route möglich";
    $response_code_arr[80] = "SMS konnte nicht versendet werden";
    $response_code_arr[90] = "Versand nicht möglich";
    $response_code_arr[100] = "SMS wurde erfolgreich versendet.";
    $body = $param["message"] . "<br><br><i>Status: " . $response_code_arr[$response_code] . "</i>";
    db_query('INSERT INTO {cc_mail_queue} (receiver, sender, subject, body, htmlmail_yn, priority, 
               modified_date, modified_pid, send_date, error, reading_count) 
            VALUES (:receiver, :sender, :subject, :body, :htmlmail_yn, :priority, 
               :modified_date, :modified_pid, :send_date, :error, :reading_count)', array(":receiver" => $param["to"], ":sender" => "{$user->vorname} {$user->name}", ":subject" => shorten_string($param["message"], 30), ":body" => $body, ":htmlmail_yn" => 0, ":priority" => 1, ":modified_date" => current_date(), ":modified_pid" => $user->id, ":send_date" => current_date(), ":error" => $response_code == 100 ? 0 : 1, ":reading_count" => 0));
    return $response_code_arr[$response_code];
}
Exemplo n.º 13
0
    return $retval;
}
if (isset($_POST['title'])) {
    $title = $_POST['title'];
    $privacy_level = $_POST['privacy_level'];
    $price = $_POST['price'];
    $description = $_POST['description'];
    if (!empty($_POST['short_description'])) {
        $short_description = $_POST['short_description'];
    } else {
        $short_description = shorten_string($description, 30);
    }
    if (!empty($_POST['long_description'])) {
        $long_description = $_POST['long_description'];
    } else {
        $long_description = shorten_string($description, 60);
    }
    $available_places = $_POST['available_places'];
    $online_booking = $_POST['online_booking'];
    echo '<h1>' . $online_booking . '</h1>';
    // CHECKING INPUT DATA :::::::
    // check if title is empty
    if (empty($title)) {
        $title_not_empty = FALSE;
    }
    // check is title is valid < 140 chars
    if (strlen($title) > 140) {
        $title_valid = FALSE;
    }
    //privacy_level is empty
    if (empty($privacy_level_not_empty)) {
                        ?>
                      <div class="authors">
                        <?php 
                        echo $author_names;
                        ?>
                      </div>
                      <?php 
                    }
                    ?>
                      <?php 
                    if (false and $articles_pods->get_field('abstract')) {
                        //disable until we can generate plain text only
                        ?>
                      <div class="excerpt">
                        <?php 
                        echo shorten_string($articles_pods->get_field('abstract'), 30);
                        ?>
<a href="<?php 
                        echo PODS_BASEURI_ARTICLES . '/' . $articles_pods->get_field('slug');
                        ?>
">...</a>
                      </div>
                      <?php 
                    }
                    ?>
                    </div><!-- .article -->
                <?php 
                }
            }
            ?>
                </section><!-- publication-section-<?php 
Exemplo n.º 15
0
function x_words_from_post($num, $content = '', $already_filtered = false) { /*global post;*/
	if (!$content)
		$content = get_the_content('');
	if (!$already_filtered)
		$content = apply_filters('the_content', $content);
	$content = str_replace(']]>', ']]&gt;', $content);
	$content = str_replace('&lt;![CDATA[', '', $content); // get rid of bogus CDATA on imported posts?
	$content = str_replace(']]&gt;', '', $content); // get rid of bogus CDATA on imported posts?
	$content = str_replace('&apos;', '&#39;', $content); // IE doesn't understand &apos
	$content = preg_replace('#<p class="wp-caption-text">(.+)</p>#i', '', $content); // remove photo captions
	/*$content = preg_replace('#<script(.+)</script>#i', '', $content);*/ // make sure no scripts are in there
	/*$content = preg_replace("#<style(.+)</style>#i", '', $content);*/ // make sure no styles are in there
	//$content = preg_replace('#[(.+)]#i', '', $content); // remove wordpress smart tags (and some babies)
	$content = preg_replace('/<(style|script).*?<\/\1>/xmsi', '', $content); // removes both script and style
	$content = strip_tags($content, '');
	$content = shorten_string($content, $num); //echo $content;
	return $content;
}
Exemplo n.º 16
0
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
require_once "{$_SESSION["root_path"]}/page_top.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("search:{$_REQUEST["q"]}");
if (is_numeric($_REQUEST["q"])) {
    $result = mysql_query("SELECT * FROM `quick_discussions` WHERE `id` = '{$_REQUEST["q"]}'");
    if (mysql_num_rows($result) > 0) {
        echo "<script type='text/javascript'> load_page('view_single_discussion.php?id={$_REQUEST["q"]}'); </script>";
    } else {
        echo "<p>" . translate("No post found...", "Không tìm được bài nào...") . "</p>";
    }
} else {
    $search_query = addslashes(strip_tags($_REQUEST["q"]));
    $result = mysql_query("SELECT * FROM `quick_discussions` WHERE `title` LIKE '%{$search_query}' OR `body` LIKE '%{$search_query}%' ORDER BY `last_touched` DESC");
    if (mysql_num_rows($result) === 0) {
        echo "<p>" . translate("No post found...", "Không tìm được bài nào...") . "</p>";
    } else {
        echo "<div style='text-align: left;'>\n\t\t\t<strong>" . translate(mysql_num_rows($result) . " post(s) found", "Tìm được " . mysql_num_rows($result) . " bài") . ":</strong>\n\t\t\t<ul>";
        while ($row = mysql_fetch_object($result)) {
            $post = new QuickDiscussion();
            $post->load($row->id);
            $body = shorten_string(strip_tags($post->body), 100);
            echo "<li><strong><a onClick=\"javascript: load_page('view_single_discussion.php?id={$post->id}');\">" . (empty($post->title) ? "[ " . translate("No title", "Không chủ đề") . " ]" : $post->title) . "</a></strong> ---- <em>{$body}</em></li>";
        }
        echo "\t</ul>\n\t\t</div>";
    }
}
?>

<?php 
require_once "{$_SESSION["root_path"]}/page_bottom.php";