Ejemplo n.º 1
0
<?php

debug_backtrace() || die("Direct access not permitted.");
?>

<?php 
$pdo = db_connect();
$rows = db_get('scl_students');
$plug_path = plugin_path('school_management_vor');
require 'imageResize.php';
$db_ids = array();
foreach ($rows as $row) {
    $db_ids[] = $row['image'];
}
$accs = db_get('vor_admin');
$db_accs = array();
foreach ($accs as $acc) {
    $db_accs[] = $acc['image'];
}
$image_id_dir = $plug_path . 'images/scl_students/';
$image_acc_dir = 'img/admin/';
$stored_id_images = glob($image_id_dir . '*.jpg');
$stored_acc_images = glob($image_acc_dir . '*.jpg');
$def_image = array_search('img/admin/default_image.png', $stored_acc_images);
unset($stored_acc_images[$def_image]);
if (!empty($stored_id_images)) {
    $stored_image_m = array();
    foreach ($stored_id_images as $stored_image) {
        $stored_image_m[] = basename($stored_image);
    }
    foreach ($stored_image_m as $stored_image_h) {
Ejemplo n.º 2
0
 function comments_template_loader($template)
 {
     if (get_post_type() !== 'debate') {
         return $template;
     }
     $check_dirs = array(trailingslashit(get_stylesheet_directory()) . plugin_path(), trailingslashit(get_template_directory()) . plugin_path(), trailingslashit(get_stylesheet_directory()), trailingslashit(get_template_directory()), trailingslashit(plugin_path()) . 'templates/');
     foreach ($check_dirs as $dir) {
         if (file_exists(trailingslashit($dir) . 'comments-debate.php')) {
             return trailingslashit($dir) . 'comments-debate.php';
         }
     }
 }
Ejemplo n.º 3
0
function broadcast_omb_notice(&$model, &$rec)
{
    if (!isset($rec->title) || !isset($rec->uri)) {
        return;
    }
    global $request, $db;
    if (empty($rec->uri)) {
        $rec->set_value('uri', $request->url_for(array('resource' => '__' . $rec->id)));
        $rec->save_changes();
    }
    wp_plugin_include(array('wp-oauth'));
    $i = owner_of($rec);
    $listenee_uri = $i->profile;
    $notice_uri = $rec->uri;
    $notice_content = substr($rec->title, 0, 140);
    $notice_url = $notice_uri;
    $license = $i->license;
    $sent_to = array();
    $Subscription = $db->model('Subscription');
    $Subscription->has_one('subscriber:identity');
    $where = array('subscriptions.subscribed' => $i->id);
    $Subscription->set_param('find_by', $where);
    $Subscription->find();
    while ($sub = $Subscription->MoveNext()) {
        $sub_token = trim($sub->token);
        $sub_secret = trim($sub->secret);
        $sid = $sub->FirstChild('identities');
        $url = $sid->post_notice;
        if (!in_array($url, $sent_to) && !empty($url) && !strstr($url, $request->base)) {
            $sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
            $wp_plugins = "wp-plugins" . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "enabled";
            $path = plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . 'wp-openid' . DIRECTORY_SEPARATOR;
            add_include_path($path);
            require_once "Auth/Yadis/Yadis.php";
            $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
            //for ($i=0;$i<5;$i++) {
            $consumer = new OAuthConsumer($request->base, '');
            $token = new OAuthToken($sub_token, $sub_secret);
            $parsed = parse_url($url);
            $params = array();
            parse_str($parsed['query'], $params);
            $req = OAuthRequest::from_consumer_and_token($consumer, $token, "POST", $url, $params);
            $req->set_parameter('omb_version', OMB_VERSION);
            $req->set_parameter('omb_listenee', $listenee_uri);
            $req->set_parameter('omb_notice', $notice_uri);
            $req->set_parameter('omb_notice_content', $notice_content);
            $req->set_parameter('omb_notice_url', $notice_url);
            $req->set_parameter('omb_notice_license', $license);
            $req->sign_request($sha1_method, $consumer, $token);
            $result = $fetcher->post($req->get_normalized_http_url(), $req->to_postdata());
            if ($result->status == 403) {
                $db->delete_record($sub);
            } else {
                parse_str($result->body, $return);
                if (is_array($return) && $return['omb_version'] == OMB_VERSION) {
                    $sent_to[] = $url;
                } else {
                    admin_alert('failed to post' . "\n\n" . $url . "\n\n" . $result->body . "\n\n" . $notice_content);
                }
            }
            //}
            // this is the old CURL version of omb_notice
            //$curl = curl_init($url);
            //curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
            //curl_setopt($curl, CURLOPT_HEADER, false);
            //curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            //curl_setopt($curl, CURLOPT_POST, true);
            //curl_setopt($curl, CURLOPT_POSTFIELDS, $req->to_postdata());
            //curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            //$result = curl_exec($curl);
            //curl_close($curl);
        }
    }
}
			<div class="col-xs-12">
				<p><?php 
    _e('Duration:', 'oxd');
    ?>
&nbsp;<?php 
    echo get_post_meta(get_the_ID(), 'duration-select', true);
    ?>
&nbsp;<?php 
    _e('days', 'oxd');
    ?>
</p>
			</div>
		</div>
	</section>


<?php 
    comments_template($file = plugin_path() . '/comments-debate.php', $separate_comments = false);
    ?>


</article>

 <?php 
}
// end of the loop.
?>

<?php 
get_sidebar();
get_footer();
Ejemplo n.º 5
0
function wp_plugin_include($file, $basedir = NULL)
{
    $wp_plugins = "wp-content" . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . $file;
    if (is_dir($wp_plugins)) {
        $startfile = $wp_plugins . DIRECTORY_SEPARATOR . $file . ".php";
        if (is_file($startfile)) {
            require_once $startfile;
            return;
        }
        $startfile = $wp_plugins . DIRECTORY_SEPARATOR . str_replace('wordpress', 'wp', $file) . ".php";
        if (is_file($startfile)) {
            require_once $startfile;
            return;
        }
        $file = str_replace('-', '_', $file);
        $startfile = $wp_plugins . DIRECTORY_SEPARATOR . str_replace('wordpress', 'wp', $file) . ".php";
        if (is_file($startfile)) {
            require_once $startfile;
            return;
        }
        $startfile = $wp_plugins . DIRECTORY_SEPARATOR . 'plugin.php';
        if (is_file($startfile)) {
            require_once $startfile;
            return;
        }
    }
    $wp_plugins = "wp-plugins" . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "enabled";
    if (is_array($file)) {
        foreach ($file as $f) {
            if (file_exists(plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $f . DIRECTORY_SEPARATOR . 'plugin.php')) {
                require_once plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $f . DIRECTORY_SEPARATOR . 'plugin.php';
            } elseif (file_exists(plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $f . DIRECTORY_SEPARATOR . 'core.php')) {
                require_once plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $f . DIRECTORY_SEPARATOR . 'core.php';
            } elseif (file_exists(plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $f . ".php")) {
                require_once plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $f . ".php";
            }
        }
    } else {
        if (file_exists(plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $file . DIRECTORY_SEPARATOR . 'plugin.php')) {
            require_once plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $file . DIRECTORY_SEPARATOR . 'plugin.php';
        } elseif (file_exists(plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $file . DIRECTORY_SEPARATOR . 'core.php')) {
            require_once plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $file . DIRECTORY_SEPARATOR . 'core.php';
        } elseif (file_exists(plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $file . ".php")) {
            require_once plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . $file . ".php";
        }
    }
}
Ejemplo n.º 6
0
function broadcast_omb_profile_update()
{
    global $request, $db;
    wp_plugin_include(array('wp-oauth'));
    $i = get_profile();
    $listenee_uri = $i->profile;
    $license = $i->license;
    $sent_to = array();
    $Subscription = $db->model('Subscription');
    $Subscription->has_one('subscriber:identity');
    $where = array('subscriptions.subscribed' => $i->id);
    $Subscription->set_param('find_by', $where);
    $Subscription->find();
    while ($sub = $Subscription->MoveNext()) {
        $sub_token = trim($sub->token);
        $sub_secret = trim($sub->secret);
        $sid = $sub->FirstChild('identities');
        $url = $sid->update_profile;
        if (!in_array($url, $sent_to) && !empty($url) && !strstr($url, $request->base)) {
            $sent_to[] = $url;
            $sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
            $wp_plugins = "wp-plugins" . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "enabled";
            $path = plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . 'wp-openid' . DIRECTORY_SEPARATOR;
            add_include_path($path);
            require_once "Auth/Yadis/Yadis.php";
            $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
            $consumer = new OAuthConsumer($request->base, '');
            $token = new OAuthToken($sub_token, $sub_secret);
            $parsed = parse_url($url);
            $params = array();
            parse_str($parsed['query'], $params);
            $req = OAuthRequest::from_consumer_and_token($consumer, $token, "POST", $url, $params);
            $req->set_parameter('omb_version', OMB_VERSION);
            $req->set_parameter('omb_listenee', $listenee_uri);
            $listenee_params = array('omb_listenee_profile' => $i->profile, 'omb_listenee_nickname' => $i->nickname, 'omb_listenee_license' => $i->license, 'omb_listenee_fullname' => $i->fullname, 'omb_listenee_homepage' => $i->homepage, 'omb_listenee_bio' => $i->bio, 'omb_listenee_location' => $i->locality, 'omb_listenee_avatar' => $i->avatar);
            foreach ($listenee_params as $k => $v) {
                $req->set_parameter($k, $v);
            }
            $req->sign_request($sha1_method, $consumer, $token);
            $result = $fetcher->post($req->get_normalized_http_url(), $req->to_postdata());
            if ($result->status == 403) {
                // not so much
            } else {
                parse_str($result->body, $return);
                if (is_array($return) && $return['omb_version'] == OMB_VERSION) {
                    // nice
                } else {
                    // could be better
                }
            }
        }
    }
}