/** * View section base menu; * @params: $type = (frontend or backend( * @note This will fetch layout from defualt template that how menu should appear; check menu file for more info; * * @last edit: $arsalanshah * @return: mixed data; * */ function ossn_view_sections_menu($menu, $type = 'frontend') { global $Ossn; if (isset($menu) && isset($Ossn->sectionsmenu[$type][$menu])) { $active_theme = ossn_site_settings('theme'); $params['menu'] = $Ossn->sectionsmenu[$type][$menu]; $params['menuname'] = $menu; return ossn_view("themes/{$active_theme}/menus/sections/{$menu}", $params); } }
/** * Generate token using timestamp * * @param array $timestamp current timestamp * @return string */ function ossn_generate_action_token($timestamp) { if (!isset($timestamp) && empty($timestamp)) { $timestamp = time(); } $site_screat = ossn_site_settings('site_key'); $session_id = session_id(); return md5($timestamp . $site_screat . $session_id); }
/** * Load system locales * * @return void */ function ossn_load_locales() { global $Ossn; $active = ossn_site_settings('language'); if (isset($Ossn->locale[$active])) { foreach ($Ossn->locale[$active] as $locales) { if (is_file($locales)) { include_once $locales; } } } }
/** * Load css to system * * @return html.tags */ function ossn_site_js() { global $Ossn; $url = ossn_site_url(); if (isset($Ossn->jshead)) { foreach ($Ossn->jshead as $js) { $src = "{$url}js/view/{$js}.js"; if (ossn_site_settings('cache') == 1) { $src = "{$url}cache/js/view/{$js}.js"; } echo ossn_html_js(array('src' => $src)); } } }
/** * Send email to user. * * @parans = $email => user email * $subject => email subject * $body = email body * * @return (bool) */ public function NotifiyUser($email, $subject, $body) { $this->setFrom(ossn_site_settings('notification_email'), ossn_site_settings('site_name')); $this->addAddress($email); $this->Subject = $subject; $this->Body = $body; $this->CharSet = "UTF-8"; try { if ($this->send()) { return true; } } catch (phpmailerException $e) { error_log("Cannot send email " . $e->errorMessage(), 0); } return false; }
/** * Send email to user. * * @param string $email User email address * @param string $subject Email subject * @param string $body Email body * * @return boolean */ public function NotifiyUser($email, $subject, $body) { if (empty($email)) { error_log('Can not send email to empty email address', 0); } $this->setFrom(ossn_site_settings('notification_email'), ossn_site_settings('site_name')); $this->addAddress($email); $this->Subject = $subject; $this->Body = $body; $this->CharSet = "UTF-8"; try { $send = ossn_call_hook('email', 'send', $this->send(), $this); if ($send) { return true; } } catch (phpmailerException $e) { error_log("Cannot send email " . $e->errorMessage(), 0); } return false; }
/** * Send emails to provided addresses * * @return bool; */ public function sendInvitation() { $email = $this->address; $message = strip_tags($this->message); $message = html_entity_decode($message, ENT_QUOTES, "UTF-8"); $message = ossn_restore_new_lines($message); $user = ossn_loggedin_user(); if (!isset($user->guid) || empty($email)) { return false; } $site = ossn_site_settings('site_name'); $url = ossn_site_url(); if (empty($message)) { $params = array($url, $user->profileURL(), $user->fullname); $message = ossn_print('com:ossn:invite:mail:message:default', $params); } else { $params = array($site, $user->fullname, $message, $url, $user->profileURL()); $message = ossn_print("com:ossn:invite:mail:message", $params); } $subject = ossn_print("com:ossn:invite:mail:subject", array($site)); return $this->NotifiyUser($email, $subject, $message); }
/** * Trigger upgrade / Run upgrade * * @return void; * @access private */ function ossn_trigger_upgrades() { if (!ossn_isAdminLoggedin()) { ossn_error_page(); } $upgrades = ossn_get_process_upgrade_files(); if (!is_array($upgrades) || empty($upgrades)) { ossn_trigger_message(ossn_print('upgrade:not:available'), 'error', 'admin'); redirect('administrator'); return false; } foreach ($upgrades as $upgrade) { $file = ossn_route()->upgrade . "upgrades/{$upgrade}"; if (!(include_once $file)) { throw new exception(ossn_print('upgrade:file:load:error')); } } //need to reset cache files if (ossn_site_settings('cache') !== 0) { ossn_trigger_css_cache(); ossn_trigger_js_cache(); } return true; }
/** * Load json locales. * * @return string|false or false */ function ossn_load_json_locales() { global $Ossn; $code = ossn_site_settings('language'); $json = json_encode($Ossn->localestr[$code]); if ($json) { return $json; } return false; }
/** function ossn_jquery_add() { echo ossn_html_js(array('src' => ossn_site_url('vendors/jquery/jquery-1.11.1.min.js'))); } **/ function ossn_languages_js() { $lang = ossn_site_settings('language'); $cache = ossn_site_settings('cache'); $last_cache = ossn_site_settings('last_cache'); if ($cache == true) { $js = "ossn.{$lang}.language"; $url = "cache/js/{$last_cache}/view/{$js}.js"; ossn_new_external_js($js, $url); ossn_load_external_js($js, 'site'); ossn_load_external_js($js, 'admin'); } else { ossn_new_js('ossn.language', 'javascripts/libraries/languages'); ossn_load_js('ossn.language'); ossn_load_js('ossn.language', 'admin'); } }
<script> <?php echo ossn_fetch_extend_views('ossn/admin/js/head'); ?> </script> <script> tinymce.init({ toolbar: "bold italic underline alignleft aligncenter alignright bullist numlist image media link unlink emoticons autoresize fullscreen insertdatetime print spellchecker preview", selector: '.ossn-editor', plugins: "code image media link emoticons fullscreen insertdatetime print spellchecker preview", convert_urls: false, relative_urls: false, language: "<?php echo ossn_site_settings('language'); ?> ", }); </script> </head> <body> <div class="header"> <div class="container"> <div class="row"> <div class="col-md-6"> <img src="<?php echo ossn_theme_url();
/** * Load registered css to system for admin * * @return html.tag */ function ossn_css_admin() { global $Ossn; $url = ossn_site_url(); if (isset($Ossn->csshead['admin'])) { foreach ($Ossn->csshead['admin'] as $css) { $href = "{$url}css/view/{$css}.css"; if (ossn_site_settings('cache') == 1) { $href = "{$url}cache/css/view/{$css}.css"; } echo ossn_html_css(array('href' => $href)); } } }
* @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://www.opensource-socialnetwork.org/licence * @link http://www.opensource-socialnetwork.org/licence */ ?> <div class="home-left-contents"> <h1><?php echo ossn_print('home:top:heading', array(ossn_site_settings('site_name'))); ?> </h1> <img src="<?php echo ossn_site_url(); ?> themes/<?php echo ossn_site_settings('theme'); ?> /images/home-people.png"/> </div> <div class="home-right-contents"> <h1> <?php echo ossn_print('create:account'); ?> </h1> <div class="h1-bottom"> <?php echo ossn_print('its:free'); ?> </div> <br/> <?php
<canvas id="users-classified-graph"></canvas> <div id="userclassified-lineLegend"></div> </div> </div> </div> <div class="col-md-4 admin-dashboard-item"> <div class="admin-dashboard-box"> <div class="admin-dashboard-title"><?php echo ossn_print('my:version'); ?> </div> <div class="admin-dashboard-contents center admin-dashboard-fixed-height"> <div class="text center"> <?php echo ossn_site_settings('site_version'); ?> </div> <canvas id="users-classified-graph"></canvas> <div id="userclassified-lineLegend"></div> </div> </div> </div> <div class="col-md-4 admin-dashboard-item"> <div class="admin-dashboard-box"> <div class="admin-dashboard-title"><?php echo ossn_print('admin:cache'); ?> </div> <div class="admin-dashboard-contents center admin-dashboard-fixed-height"> <div class="text center">
<?php /** * OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.com/licence */ $site_name = ossn_site_settings('site_name'); if (isset($params['title'])) { $title = $params['title'] . ' : ' . $site_name; } else { $title = ossn_site_settings('site_name'); } if (isset($params['contents'])) { $contents = $params['contents']; } else { $contents = ''; } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $title; ?> </title>
<a role="button" data-target="#"> <i class="fa fa-th-list"></i></a> </li> </div> <?php } ?> </div> <div class="col-md-7 site-name text-center <?php echo $hide_loggedin; ?> "> <span><a href="<?php echo ossn_site_url(); ?> "><?php echo ossn_site_settings('site_name'); ?> </a></span> </div> <div class="col-md-3 text-right right-side"> <div class="topbar-menu-right"> <li class="ossn-topbar-dropdown-menu"> <div class="dropdown"> <?php if (ossn_isLoggedin()) { echo ossn_plugin_view('output/url', array('role' => 'button', 'data-toggle' => 'dropdown', 'data-target' => '#', 'text' => '<i class="fa fa-sort-desc"></i>')); echo ossn_view_menu('topbar_dropdown'); } ?> </div> </li>
/** * Load registered css to system for admin * * @return html.tag */ function ossn_css_admin() { global $Ossn; $url = ossn_site_url(); //load external css $external = $Ossn->cssheadExternal['admin']; if (!empty($external)) { foreach ($external as $item) { echo ossn_html_css(array('href' => $Ossn->cssExternal[$item])); } } //load internal css if (isset($Ossn->csshead['admin'])) { foreach ($Ossn->csshead['admin'] as $css) { $href = "{$url}css/view/{$css}.css"; if (ossn_site_settings('cache') == 1) { $cache = ossn_site_settings('last_cache'); $href = "{$url}cache/css/{$cache}/view/{$css}.css"; } echo ossn_html_css(array('href' => $href)); } } }
/** * Ossn php display erros settings * * @return (void); * @access pritvate; */ function ossn_errros() { $settings = ossn_site_settings('display_errors'); if ($settings == 'on' || is_file(ossn_route()->www . 'DISPLAY_ERRORS')) { error_reporting(E_NOTICE ^ ~E_WARNING); ini_set('log_errors', 1); ini_set('error_log', ossn_route()->www . 'error_log'); set_error_handler('_ossn_php_error_handler'); } elseif ($settings !== 'on') { ini_set("log_errors", 0); ini_set('display_errors', 'off'); } }
<?php /** * Open Source Social Network * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://www.opensource-socialnetwork.org/licence * @link http://www.opensource-socialnetwork.org/licence */ $disable = input('disabled'); if (ossn_site_settings('cache') == true || !empty($disable)) { if (ossn_disable_cache() && empty($disable)) { //flush cache didn't flush the plugins path #460 $action = ossn_add_tokens_to_url("action/admin/cache/flush?disabled=disabled"); redirect($action); } elseif ($disable == 'disabled') { if (ossn_create_cache()) { ossn_trigger_message(ossn_print('cache:flushed')); redirect(REF); } } } ossn_trigger_message(ossn_print('cache:flush:error'), 'error'); redirect(REF);
/** * View admin sidebar menu * * @return html */ function ossn_view_admin_sidemenu() { global $Ossn; $params['menu'] = $Ossn->menu['admin/sidemenu']; $active_theme = ossn_site_settings('theme'); return ossn_view("themes/{$active_theme}/menus/admin_sidemenu", $params); }
<?php /** * Open Source Social Network * * @packageOpen Source Social Network * @author Open Social Website Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://www.opensource-socialnetwork.org/licence * @link http://www.opensource-socialnetwork.org/licence */ $cache = ossn_site_settings('cache'); if ($cache == 1) { $enabled = 'selected'; $disabled = ''; } elseif ($cache == 0) { $disabled = 'selected'; $enabled = ''; } ?> <h4> Status : <?php echo ossn_print("cache:{$cache}"); ?> </h4> <div> <select name="cache"> <option value="1" <?php echo $enabled; ?> > <?php
/** * Generate a paths for plugins for cache * * @return string|false */ function ossn_plugins_cache_paths() { $file = ossn_get_userdata("system/plugins_paths"); if (is_file($file) && ossn_site_settings('cache') == 1) { $file = file_get_contents($file); return json_decode($file, true); } return false; }
<?php echo '<div class="ossn-admin-sidemenu">'; foreach ($params['menu'] as $value) { foreach ($value as $key => $value) { echo "<div class='title'>" . strtoupper($key) . "</div>"; echo "<div class='links'>"; foreach ($value as $name => $link) { $name_link = ossn_print($name); $icon = str_replace(':', '-', $name); $active_theme = ossn_site_settings('theme'); $icon = ossn_site_url("themes/{$active_theme}/images/administrator/icons/{$icon}.png"); $icon = "<div class='icon' style='background:url(\"{$icon}\") no-repeat;'></div>"; echo "<a href='{$link}'><li><div class='inner-li'>{$icon}<div class='text'>{$name_link}</div></div></li></a>"; } echo '</div>'; } } echo '</div>';
<a data-parent="#accordion" href="#collapse-<?php echo $translit; ?> " data-toggle="collapse"> <?php echo $params['theme']->name; ?> <?php echo $params['theme']->version; ?> <i class="fa fa-sort-desc"></i> </a> <div class="right"> <?php if (ossn_site_settings('theme') == $id) { ?> <i title="<?php echo ossn_print('admin:button:enabled'); ?> " class="component-title-icon component-title-check fa fa-check-circle"></i> <?php } else { ?> <i title="<?php echo ossn_print('admin:button:disabled'); ?> " class="component-title-icon component-title-delete fa fa-times-circle-o"></i> <?php } ?>
/** * Check theme requirments * * @param string $element A valid theme xml file * * @return false|array */ public static function checkRequirments($element) { if (empty($element)) { return false; } $types = array('ossn_version', 'php_extension', 'php_version', 'php_function'); if (isset($element->name)) { if (isset($element->requires)) { $result = array(); $requires = $element->requires; foreach ($requires as $item) { if (!in_array($item->type, $types)) { continue; } $requirments = array(); //version checks if ($item->type == 'ossn_version') { $requirments['type'] = ossn_print('ossn:version'); $requirments['value'] = (string) $item->version; $requirments['availability'] = 0; $site_version = (int) ossn_site_settings('site_version'); if ($site_version <= $item->version && $site_version == (int) $item->version) { $requirments['availability'] = 1; } } //check php extension if ($item->type == 'php_extension') { $requirments['type'] = ossn_print('php:extension'); $requirments['value'] = (string) $item->name; $requirments['availability'] = 0; if (extension_loaded($item->name)) { $requirments['availability'] = 1; } } //check php version if ($item->type == 'php_version') { $requirments['type'] = ossn_print('php:version'); $requirments['value'] = (string) $item->version; $requirments['availability'] = 0; $phpversion = substr(PHP_VERSION, 0, 6); if ($phpversion >= $item->version) { $requirments['availability'] = 1; } } //check php function if ($item->type == 'php_function') { $requirments['type'] = ossn_print('php:function'); $requirments['value'] = (string) $item->name; $requirments['availability'] = 0; if (function_exists($item->name)) { $requirments['availability'] = 1; } } $result[] = $requirments; } //loop return $result; } } return false; }
/** * Call a structure of pagination; * * @params = array(count, active) * * @return html; */ private function view($params) { $theme = ossn_site_settings('theme'); return ossn_view("themes/{$theme}/pagination/view", $params); }
/** * Load all active components * * @return false|null startup files; */ public function loadComs() { $coms = $this->getActive(); $lang = ossn_site_settings('language'); if (!$coms) { return false; } foreach ($coms as $com) { $dir = ossn_route()->com; $name = $this->getCom($com->com_id); if (!empty($name->com_name)) { if (is_file("{$dir}{$com->com_id}/locale/ossn.{$lang}.php")) { include "{$dir}{$com->com_id}/locale/ossn.{$lang}.php"; } include_once "{$dir}{$com->com_id}/ossn_com.php"; } } }
/** * Send user reset password link * * @return bool; */ public function SendResetLogin() { self::initAttributes(); $this->old_code = $this->getParam('login:reset:code'); $this->type = 'user'; $this->subtype = 'login:reset:code'; $this->owner_guid = $this->guid; if (!isset($this->{'login:reset:code'}) && empty($this->old_code)) { $this->value = md5(time() . $this->guid); $this->add(); } else { $this->value = md5(time() . $this->guid); $this->data->{'login:reset:code'} = $this->value; $this->save(); } $emailreset_url = ossn_site_url("resetlogin?user={$this->username}&c={$this->value}"); $emailreset_url = ossn_call_hook('user', 'icon:urls', $this, $emailreset_url); $sitename = ossn_site_settings('site_name'); $emailmessage = ossn_print('ossn:reset:password:body', array($this->first_name, $emailreset_url, $sitename)); $emailsubject = ossn_print('ossn:reset:password:subject'); if (!empty($this->value)) { return true; } return false; }
<?php /** * OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.com/licence */ $sitename = ossn_site_settings('site_name'); if (isset($params['title'])) { $title = $params['title'] . ' : ' . $sitename; } else { $title = $sitename; } if (isset($params['contents'])) { $contents = $params['contents']; } else { $contents = ''; } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title><?php echo $title; ?> </title>
/** * Resend validation email to user * * @return boolean */ public function resendValidationEmail() { self::initAttributes(); if (!$this->isUserVALIDATED()) { $link = ossn_site_url("uservalidate/activate/{$this->guid}/{$this->activation}"); $link = ossn_call_hook('user', 'validation:email:url', $this, $link); $sitename = ossn_site_settings('site_name'); $activation = ossn_print('ossn:add:user:mail:body', array($sitename, $link, ossn_site_url())); $subject = ossn_print('ossn:add:user:mail:subject', array($this->first_name, $sitename)); return $this->notify->NotifiyUser($this->email, $subject, $activation); } return false; }