当前位置: 首页>>代码示例>>PHP>>正文


PHP osc_lib_path函数代码示例

本文整理汇总了PHP中osc_lib_path函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_lib_path函数的具体用法?PHP osc_lib_path怎么用?PHP osc_lib_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了osc_lib_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doModel


//.........这里部分代码省略.........
                         if (preg_match('#' . $match . '#', $request_uri, $m)) {
                             $request_uri = preg_replace('#' . $match . '#', $uri, $request_uri);
                             if (preg_match('|([&?]{1})page=([^&]*)|', '&' . $request_uri . '&', $match)) {
                                 $page_redirect = $match[2];
                                 if ($page_redirect == '' || $page_redirect == 'login') {
                                     $url_redirect = osc_user_dashboard_url();
                                 }
                             }
                             break;
                         }
                     }
                 }
             }
             require_once LIB_PATH . 'osclass/UserActions.php';
             $uActions = new UserActions(false);
             $logged = $uActions->bootstrap_login($user['pk_i_id']);
             if ($logged == 0) {
                 osc_add_flash_error_message(_m("The user doesn't exist"));
             } else {
                 if ($logged == 1) {
                     if (time() - strtotime($user['dt_access_date']) > 1200) {
                         // EACH 20 MINUTES
                         osc_add_flash_error_message(sprintf(_m('The user has not been validated yet. Would you like to re-send your <a href="%s">activation?</a>'), osc_user_resend_activation_link($user['pk_i_id'], $user['s_email'])));
                     } else {
                         osc_add_flash_error_message(_m('The user has not been validated yet'));
                     }
                 } else {
                     if ($logged == 2) {
                         osc_add_flash_error_message(_m('The user has been suspended'));
                     } else {
                         if ($logged == 3) {
                             if (Params::getParam('remember') == 1) {
                                 //this include contains de osc_genRandomPassword function
                                 require_once osc_lib_path() . 'osclass/helpers/hSecurity.php';
                                 $secret = osc_genRandomPassword();
                                 User::newInstance()->update(array('s_secret' => $secret), array('pk_i_id' => $user['pk_i_id']));
                                 Cookie::newInstance()->set_expires(osc_time_cookie());
                                 Cookie::newInstance()->push('oc_userId', $user['pk_i_id']);
                                 Cookie::newInstance()->push('oc_userSecret', $secret);
                                 Cookie::newInstance()->set();
                             }
                             if ($url_redirect == '') {
                                 $url_redirect = osc_user_dashboard_url();
                             }
                             osc_run_hook("after_login", $user, $url_redirect);
                             $this->redirectTo(osc_apply_filter('correct_login_url_redirect', $url_redirect));
                         } else {
                             osc_add_flash_error_message(_m('This should never happen'));
                         }
                     }
                 }
             }
             if (!$user['b_enabled']) {
                 $this->redirectTo(osc_user_login_url());
             }
             $this->redirectTo(osc_user_login_url());
             break;
         case 'resend':
             $id = Params::getParam('id');
             $email = Params::getParam('email');
             $user = User::newInstance()->findByPrimaryKey($id);
             if ($id == '' || $email == '' || !isset($user) || $user['b_active'] == 1 || $email != $user['s_email']) {
                 osc_add_flash_error_message(_m('Incorrect link'));
                 $this->redirectTo(osc_user_login_url());
             }
             if (time() - strtotime($user['dt_access_date']) > 1200) {
开发者ID:oanav,项目名称:closetshare,代码行数:67,代码来源:login.php

示例2: osc_latestTweets

function osc_latestTweets($num = 5)
{
    require_once osc_lib_path() . 'osclass/classes/Cache.php';
    $cache = new Cache('admin-twitter', 900);
    if ($cache->check()) {
        return $cache->retrieve();
    }
    $list = array();
    $content = osc_file_get_contents('https://twitter.com/statuses/user_timeline/osclass.rss');
    if ($content) {
        $xml = simplexml_load_string($content);
        if (isset($xml->error)) {
            return $list;
        }
        $count = 0;
        foreach ($xml->channel->item as $item) {
            $list[] = array('link' => strval($item->link), 'title' => strval($item->title), 'pubDate' => strval($item->pubDate));
            $count++;
            if ($count == $num) {
                break;
            }
        }
    }
    $cache->store($list);
    return $list;
}
开发者ID:semul,项目名称:Osclass,代码行数:26,代码来源:feeds.php

示例3: setCurrentThemePath

 private function setCurrentThemePath()
 {
     if (file_exists(osc_themes_path() . $this->theme . '/')) {
         $this->theme_exists = true;
         $this->theme_path = osc_themes_path() . $this->theme . '/';
     } else {
         $this->theme_exists = false;
         $this->theme_path = osc_lib_path() . 'osclass/gui/';
     }
 }
开发者ID:hashemgamal,项目名称:OSClass,代码行数:10,代码来源:WebThemes.php

示例4: setGuiTheme

 public function setGuiTheme()
 {
     $this->theme = '';
     $this->theme_exists = false;
     $this->theme_path = osc_lib_path() . 'osclass/gui/';
     $this->theme_url = osc_base_url() . 'oc-includes/osclass/gui/';
     $functions_path = $this->getCurrentThemePath() . 'functions.php';
     if (file_exists($functions_path)) {
         require_once $functions_path;
     }
 }
开发者ID:jmcclenon,项目名称:Osclass,代码行数:11,代码来源:WebThemes.php

示例5: doModel

 function doModel()
 {
     switch ($this->action) {
         case 'spamNbots':
             // calling the spam and bots view
             $akismet_key = osc_akismet_key();
             $akismet_status = 3;
             if ($akismet_key != '') {
                 require_once osc_lib_path() . 'Akismet.class.php';
                 $akismet_obj = new Akismet(osc_base_url(), $akismet_key);
                 $akismet_status = 2;
                 if ($akismet_obj->isKeyValid()) {
                     $akismet_status = 1;
                 }
             }
             View::newInstance()->_exportVariableToView('akismet_status', $akismet_status);
             $this->doView('settings/spamNbots.php');
             break;
         case 'akismet_post':
             // updating spam and bots option
             osc_csrf_check();
             $updated = 0;
             $akismetKey = Params::getParam('akismetKey');
             $akismetKey = trim($akismetKey);
             $updated = osc_set_preference('akismetKey', $akismetKey);
             if ($akismetKey == '') {
                 osc_add_flash_info_message(_m('Your Akismet key has been cleared'), 'admin');
             } else {
                 osc_add_flash_ok_message(_m('Your Akismet key has been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots');
             break;
         case 'recaptcha_post':
             // updating spam and bots option
             osc_csrf_check();
             $iUpdated = 0;
             $recaptchaPrivKey = Params::getParam('recaptchaPrivKey');
             $recaptchaPrivKey = trim($recaptchaPrivKey);
             $recaptchaPubKey = Params::getParam('recaptchaPubKey');
             $recaptchaPubKey = trim($recaptchaPubKey);
             $iUpdated += osc_set_preference('recaptchaPrivKey', $recaptchaPrivKey);
             $iUpdated += osc_set_preference('recaptchaPubKey', $recaptchaPubKey);
             if ($recaptchaPubKey == '') {
                 osc_add_flash_info_message(_m('Your reCAPTCHA key has been cleared'), 'admin');
             } else {
                 osc_add_flash_ok_message(_m('Your reCAPTCHA key has been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots');
             break;
     }
 }
开发者ID:oanav,项目名称:closetshare,代码行数:51,代码来源:spamnbots.php

示例6: osc_show_recaptcha

function osc_show_recaptcha($section = '')
{
    if (osc_recaptcha_public_key()) {
        require_once osc_lib_path() . 'recaptchalib.php';
        switch ($section) {
            case 'recover_password':
                $time = Session::newInstance()->_get('recover_time');
                if (time() - $time <= 1200) {
                    echo recaptcha_get_html(osc_recaptcha_public_key()) . "<br />";
                }
                break;
            default:
                echo recaptcha_get_html(osc_recaptcha_public_key());
                break;
        }
    }
}
开发者ID:hashemgamal,项目名称:OSClass,代码行数:17,代码来源:hUtils.php

示例7: doModel


//.........这里部分代码省略.........
                 $result = osc_downloadFile($source_file, $filename);
                 if ($result) {
                     // Everything is OK, continue
                     /**********************
                      ***** UNZIP FILE *****
                      **********************/
                     @mkdir(ABS_PATH . 'oc-temp', 0777);
                     $res = osc_unzip_file(osc_content_path() . 'downloads/' . $filename, ABS_PATH . 'oc-temp/');
                     if ($res == 1) {
                         // Everything is OK, continue
                         /**********************
                          ***** COPY FILES *****
                          **********************/
                         $fail = -1;
                         if ($handle = opendir(ABS_PATH . 'oc-temp')) {
                             $fail = 0;
                             while (false !== ($_file = readdir($handle))) {
                                 if ($_file != '.' && $_file != '..' && $_file != 'remove.list' && $_file != 'upgrade.sql' && $_file != 'customs.actions') {
                                     $data = osc_copy(ABS_PATH . "oc-temp/" . $_file, ABS_PATH . $_file);
                                     if ($data == false) {
                                         $fail = 1;
                                     }
                                 }
                             }
                             closedir($handle);
                             //TRY TO REMOVE THE ZIP PACKAGE
                             @unlink(osc_content_path() . 'downloads/' . $filename);
                             if ($fail == 0) {
                                 // Everything is OK, continue
                                 /************************
                                  *** UPGRADE DATABASE ***
                                  ************************/
                                 $error_queries = array();
                                 if (file_exists(osc_lib_path() . 'osclass/installer/struct.sql')) {
                                     $sql = file_get_contents(osc_lib_path() . 'osclass/installer/struct.sql');
                                     $conn = DBConnectionClass::newInstance();
                                     $c_db = $conn->getOsclassDb();
                                     $comm = new DBCommandClass($c_db);
                                     $error_queries = $comm->updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
                                 }
                                 if ($error_queries[0]) {
                                     // Everything is OK, continue
                                     /**********************************
                                      ** EXECUTING ADDITIONAL ACTIONS **
                                      **********************************/
                                     if (file_exists(osc_lib_path() . 'osclass/upgrade-funcs.php')) {
                                         // There should be no errors here
                                         define('AUTO_UPGRADE', true);
                                         require_once osc_lib_path() . 'osclass/upgrade-funcs.php';
                                     }
                                     // Additional actions is not important for the rest of the proccess
                                     // We will inform the user of the problems but the upgrade could continue
                                     /****************************
                                      ** REMOVE TEMPORARY FILES **
                                      ****************************/
                                     $path = ABS_PATH . 'oc-temp';
                                     $rm_errors = 0;
                                     $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
                                     for ($dir->rewind(); $dir->valid(); $dir->next()) {
                                         if ($dir->isDir()) {
                                             if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                                                 if (!rmdir($dir->getPathname())) {
                                                     $rm_errors++;
                                                 }
                                             }
                                         } else {
开发者ID:jmcclenon,项目名称:Osclass,代码行数:67,代码来源:ajax.php

示例8: switch

    }
}
if (!osc_users_enabled() && osc_is_web_user_logged_in()) {
    Session::newInstance()->_drop('userId');
    Session::newInstance()->_drop('userName');
    Session::newInstance()->_drop('userEmail');
    Session::newInstance()->_drop('userPhone');
    Cookie::newInstance()->pop('oc_userId');
    Cookie::newInstance()->pop('oc_userSecret');
    Cookie::newInstance()->set();
}
switch (Params::getParam('page')) {
    case 'cron':
        // cron system
        define('__FROM_CRON__', true);
        require_once osc_lib_path() . 'osclass/cron.php';
        break;
    case 'user':
        // user pages (with security)
        if (Params::getParam('action') == 'change_email_confirm' || Params::getParam('action') == 'activate_alert' || Params::getParam('action') == 'unsub_alert' && !osc_is_web_user_logged_in() || Params::getParam('action') == 'contact_post' || Params::getParam('action') == 'pub_profile') {
            require_once osc_base_path() . 'user-non-secure.php';
            $do = new CWebUserNonSecure();
            $do->doModel();
        } else {
            require_once osc_base_path() . 'user.php';
            $do = new CWebUser();
            $do->doModel();
        }
        break;
    case 'item':
        // item pages
开发者ID:randomecho,项目名称:OSClass,代码行数:31,代码来源:index.php

示例9: osc_check_recaptcha

function osc_check_recaptcha()
{
    require_once osc_lib_path() . 'recaptchalib.php';
    if (Params::getParam("recaptcha_challenge_field") != '') {
        $resp = recaptcha_check_answer(osc_recaptcha_private_key(), $_SERVER["REMOTE_ADDR"], Params::getParam("recaptcha_challenge_field"), Params::getParam("recaptcha_response_field"));
        return $resp->is_valid;
    }
    return false;
}
开发者ID:hashemgamal,项目名称:OSClass,代码行数:9,代码来源:utils.php

示例10: getConnection

        $conn = getConnection();
        $error_queries = $conn->osc_updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
    }
    if (!$error_queries[0]) {
        $skip_db_link = osc_base_url() . "oc-includes/osclass/upgrade-funcs.php?skipdb=true";
        $title = __('OSClass &raquo; Has some errors');
        $message = __('We encountered some problems updating the database structure. The following queries failed:');
        $message .= "<br/><br/>" . implode("<br>", $error_queries[2]);
        $message .= "<br/><br/>" . sprintf(__('These errors could be false-positive errors. If you\'re sure that is the case, you could <a href="%s">continue with the upgrade</a>, or <a href="http://forums.osclass.org/">ask in our forums</a>.'), $skip_db_link);
        osc_die($title, $message);
    }
}
// UPDATE DATABASE
if (!defined('AUTO_UPGRADE')) {
    if (file_exists(osc_lib_path() . 'osclass/installer/struct.sql')) {
        $sql = file_get_contents(osc_lib_path() . 'osclass/installer/struct.sql');
        $conn = getConnection();
        $conn->osc_updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
    }
}
Preference::newInstance()->update(array('s_value' => time()), array('s_section' => 'osclass', 's_name' => 'last_version_check'));
$conn = getConnection();
if (osc_version() < 210) {
    $conn->osc_dbExec(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'save_latest_searches', '0', 'BOOLEAN')", DB_TABLE_PREFIX));
    $conn->osc_dbExec(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'purge_latest_searches', '1000', 'STRING')", DB_TABLE_PREFIX));
    $conn->osc_dbExec(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'selectable_parent_categories', '1', 'BOOLEAN')", DB_TABLE_PREFIX));
    $conn->osc_dbExec(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'ping_search_engines', '1', 'BOOLEAN')", DB_TABLE_PREFIX));
    $conn->osc_dbExec(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'numImages@items', '0', 'BOOLEAN')", DB_TABLE_PREFIX));
    $enableItemValidation = getBoolPreference('enabled_item_validation') ? 0 : -1;
    $conn->osc_dbExec(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'moderate_items', '{$enableItemValidation}', 'INTEGER')", DB_TABLE_PREFIX));
    $conn->osc_dbExec(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'items_wait_time', '0', 'INTEGER')", DB_TABLE_PREFIX));
开发者ID:nsswaga,项目名称:OSClass,代码行数:31,代码来源:upgrade-funcs.php

示例11: doModel


//.........这里部分代码省略.........
                     osc_add_flash_ok_message(_m('The comment has been disapproved'), 'admin');
                 } else {
                     if ($value == 'ENABLE') {
                         $iUpdated = $this->itemCommentManager->update(array('b_enabled' => 1), array('pk_i_id' => $id));
                         osc_add_hook("enable_comment", $id);
                         osc_add_flash_ok_message(_m('The comment has been enabled'), 'admin');
                     } else {
                         if ($value == 'DISABLE') {
                             $iUpdated = $this->itemCommentManager->update(array('b_enabled' => 0), array('pk_i_id' => $id));
                             osc_add_hook("disable_comment", $id);
                             osc_add_flash_ok_message(_m('The comment has been disabled'), 'admin');
                         }
                     }
                 }
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=comments");
             break;
         case 'comment_edit':
             $comment = ItemComment::newInstance()->findByPrimaryKey(Params::getParam('id'));
             $this->_exportVariableToView('comment', $comment);
             $this->doView('comments/frm.php');
             break;
         case 'comment_edit_post':
             osc_csrf_check();
             $msg = '';
             if (!osc_validate_email(Params::getParam('authorEmail'), true)) {
                 $msg .= _m('Email is not correct') . "<br/>";
             }
             if (!osc_validate_text(Params::getParam('body'), 1, true)) {
                 $msg .= _m('Comment is required') . "<br/>";
             }
             if ($msg != '') {
                 osc_add_flash_error_message($msg, 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=comments&action=comment_edit&id=" . Params::getParam('id'));
             }
             $this->itemCommentManager->update(array('s_title' => Params::getParam('title'), 's_body' => Params::getParam('body'), 's_author_name' => Params::getParam('authorName'), 's_author_email' => Params::getParam('authorEmail')), array('pk_i_id' => Params::getParam('id')));
             osc_run_hook('edit_comment', Params::getParam('id'));
             osc_add_flash_ok_message(_m('Great! We just updated your comment'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=comments");
             break;
         case 'delete':
             osc_csrf_check();
             $this->itemCommentManager->deleteByPrimaryKey(Params::getParam('id'));
             osc_add_flash_ok_message(_m('The comment has been deleted'), 'admin');
             osc_run_hook('delete_comment', Params::getParam('id'));
             $this->redirectTo(osc_admin_base_url(true) . "?page=comments");
             break;
         default:
             require_once osc_lib_path() . "osclass/classes/datatables/CommentsDataTable.php";
             // set default iDisplayLength
             if (Params::getParam('iDisplayLength') != '') {
                 Cookie::newInstance()->push('listing_iDisplayLength', Params::getParam('iDisplayLength'));
                 Cookie::newInstance()->set();
             } else {
                 // set a default value if it's set in the cookie
                 if (Cookie::newInstance()->get_value('listing_iDisplayLength') != '') {
                     Params::setParam('iDisplayLength', Cookie::newInstance()->get_value('listing_iDisplayLength'));
                 } else {
                     Params::setParam('iDisplayLength', 10);
                 }
             }
             $this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength'));
             // Table header order by related
             if (Params::getParam('sort') == '') {
                 Params::setParam('sort', 'date');
             }
             if (Params::getParam('direction') == '') {
                 Params::setParam('direction', 'desc');
             }
             $page = (int) Params::getParam('iPage');
             if ($page == 0) {
                 $page = 1;
             }
             Params::setParam('iPage', $page);
             $params = Params::getParamsAsArray();
             $commentsDataTable = new CommentsDataTable();
             $commentsDataTable->table($params);
             $aData = $commentsDataTable->getData();
             if (count($aData['aRows']) == 0 && $page != 1) {
                 $total = (int) $aData['iTotalDisplayRecords'];
                 $maxPage = ceil($total / (int) $aData['iDisplayLength']);
                 $url = osc_admin_base_url(true) . '?' . Params::getServerParam('QUERY_STRING', false, false);
                 if ($maxPage == 0) {
                     $url = preg_replace('/&iPage=(\\d)+/', '&iPage=1', $url);
                     $this->redirectTo($url);
                 }
                 if ($page > 1) {
                     $url = preg_replace('/&iPage=(\\d)+/', '&iPage=' . $maxPage, $url);
                     $this->redirectTo($url);
                 }
             }
             $this->_exportVariableToView('aData', $aData);
             $this->_exportVariableToView('aRawRows', $commentsDataTable->rawRows());
             $bulk_options = array(array('value' => '', 'data-dialog-content' => '', 'label' => __('Bulk actions')), array('value' => 'delete_all', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected comments?'), strtolower(__('Delete'))), 'label' => __('Delete')), array('value' => 'activate_all', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected comments?'), strtolower(__('Activate'))), 'label' => __('Activate')), array('value' => 'deactivate_all', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected comments?'), strtolower(__('Deactivate'))), 'label' => __('Deactivate')), array('value' => 'disable_all', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected comments?'), strtolower(__('Block'))), 'label' => __('Block')), array('value' => 'enable_all', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected comments?'), strtolower(__('Unblock'))), 'label' => __('Unblock')));
             $bulk_options = osc_apply_filter("comment_bulk_filter", $bulk_options);
             $this->_exportVariableToView('bulk_options', $bulk_options);
             $this->doView('comments/index.php');
             break;
     }
 }
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:comments.php

示例12: doModel

 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'bulk_actions':
             osc_csrf_check();
             switch (Params::getParam('bulk_actions')) {
                 case 'delete':
                     $ids = Params::getParam("id");
                     if (is_array($ids)) {
                         foreach ($ids as $id) {
                             osc_deleteResource($id, true);
                         }
                         $log_ids = substr(implode(",", $ids), 0, 250);
                         Log::newInstance()->insertLog('media', 'delete bulk', $log_ids, $log_ids, 'admin', osc_logged_admin_id());
                         $this->resourcesManager->deleteResourcesIds($ids);
                     }
                     osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
                     break;
                 default:
                     if (Params::getParam("bulk_actions") != "") {
                         osc_run_hook("media_bulk_" . Params::getParam("bulk_actions"), Params::getParam('id'));
                     }
                     break;
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=media');
             break;
         case 'delete':
             osc_csrf_check();
             $ids = Params::getParam('id');
             if (is_array($ids)) {
                 foreach ($ids as $id) {
                     osc_deleteResource($id, true);
                 }
                 $log_ids = substr(implode(",", $ids), 0, 250);
                 Log::newInstance()->insertLog('media', 'delete', $log_ids, $log_ids, 'admin', osc_logged_admin_id());
                 $this->resourcesManager->deleteResourcesIds($ids);
             }
             osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . '?page=media');
             break;
         default:
             require_once osc_lib_path() . "osclass/classes/datatables/MediaDataTable.php";
             // set default iDisplayLength
             if (Params::getParam('iDisplayLength') != '') {
                 Cookie::newInstance()->push('listing_iDisplayLength', Params::getParam('iDisplayLength'));
                 Cookie::newInstance()->set();
             } else {
                 // set a default value if it's set in the cookie
                 if (Cookie::newInstance()->get_value('listing_iDisplayLength') != '') {
                     Params::setParam('iDisplayLength', Cookie::newInstance()->get_value('listing_iDisplayLength'));
                 } else {
                     Params::setParam('iDisplayLength', 10);
                 }
             }
             $this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength'));
             // Table header order by related
             if (Params::getParam('sort') == '') {
                 Params::setParam('sort', 'date');
             }
             if (Params::getParam('direction') == '') {
                 Params::setParam('direction', 'desc');
             }
             $page = (int) Params::getParam('iPage');
             if ($page == 0) {
                 $page = 1;
             }
             Params::setParam('iPage', $page);
             $params = Params::getParamsAsArray();
             $mediaDataTable = new MediaDataTable();
             $mediaDataTable->table($params);
             $aData = $mediaDataTable->getData();
             if (count($aData['aRows']) == 0 && $page != 1) {
                 $total = (int) $aData['iTotalDisplayRecords'];
                 $maxPage = ceil($total / (int) $aData['iDisplayLength']);
                 $url = osc_admin_base_url(true) . '?' . Params::getServerParam('QUERY_STRING', false, false);
                 if ($maxPage == 0) {
                     $url = preg_replace('/&iPage=(\\d)+/', '&iPage=1', $url);
                     $this->redirectTo($url);
                 }
                 if ($page > 1) {
                     $url = preg_replace('/&iPage=(\\d)+/', '&iPage=' . $maxPage, $url);
                     $this->redirectTo($url);
                 }
             }
             $this->_exportVariableToView('aData', $aData);
             $this->_exportVariableToView('aRawRows', $mediaDataTable->rawRows());
             $bulk_options = array(array('value' => '', 'data-dialog-content' => '', 'label' => __('Bulk actions')), array('value' => 'delete', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected media files?'), strtolower(__('Delete'))), 'label' => __('Delete')));
             $bulk_options = osc_apply_filter("media_bulk_filter", $bulk_options);
             $this->_exportVariableToView('bulk_options', $bulk_options);
             $this->doView('media/index.php');
             break;
     }
 }
开发者ID:oanav,项目名称:closetshare,代码行数:95,代码来源:media.php

示例13: osc_add_hook

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
osc_add_hook('admin_page_header', 'customPageHeader');
function customPageHeader()
{
    ?>
        <h1><?php 
    printf(__('Osclass %s'), OSCLASS_VERSION);
    ?>
            <a href="#" class="btn ico ico-32 ico-help float-right"></a>
        </h1>
    <?php 
}
function customPageTitle($string)
{
    return sprintf(__('Osclass %s &raquo; %s'), OSCLASS_VERSION, $string);
}
osc_add_filter('admin_title', 'customPageTitle');
osc_current_admin_theme_path('parts/header.php');
include osc_lib_path() . "osclass/assets/release.notes.php";
osc_current_admin_theme_path('parts/footer.php');
开发者ID:mylastof,项目名称:os-class,代码行数:31,代码来源:version.php

示例14: init

 public function init()
 {
     self::$user = $this->getUser();
     if (!osc_is_web_user_logged_in()) {
         self::$loginUrl = self::$facebook->getLoginUrl(array('scope' => 'email'));
     }
     if (!self::$user) {
         return self::$facebook;
     }
     try {
         self::$user_profile = self::$facebook->api('/me');
         $this->dao->select($this->getFields());
         $this->dao->from($this->getTableName());
         $this->dao->where('i_facebook_uid', self::$user);
         $rs = $this->dao->get();
         if ($rs !== false && $rs->numRows() === 1) {
             $fbUser = $rs->row();
             if (count($fbUser) > 0) {
                 require_once osc_lib_path() . 'osclass/UserActions.php';
                 $uActions = new UserActions(false);
                 $logged = $uActions->bootstrap_login($fbUser['fk_i_user_id']);
                 switch ($logged) {
                     case 0:
                         osc_add_flash_error_message(__('The username doesn\'t exist', 'facebook'));
                         break;
                     case 1:
                         osc_add_flash_error_message(__('The user has not been validated yet', 'facebook'));
                         break;
                     case 2:
                         osc_add_flash_error_message(__('The user has been suspended', 'facebook'));
                         break;
                     case 3:
                         //osc_add_flash_ok_message( __( 'Login successfull', 'facebook' ) );
                         break;
                 }
                 return self::$facebook;
             }
         }
         if (!isset(self::$user_profile['email'])) {
             osc_add_flash_error_message(__('Some error occured trying to connect with Facebook.', 'facebook'));
             header('Location: ' . self::$logoutUrl);
             exit;
         }
         $manager = User::newInstance();
         $oscUser = $manager->findByEmail(self::$user_profile['email']);
         // exists on our DB, we merge both accounts
         if (count($oscUser) > 0) {
             require_once osc_lib_path() . 'osclass/UserActions.php';
             $uActions = new UserActions(false);
             $manager->dao->from($this->getTableName());
             $manager->dao->set('fk_i_user_id', $oscUser['pk_i_id']);
             $manager->dao->set('i_facebook_uid', self::$user_profile['id']);
             $manager->dao->insert();
             osc_add_flash_ok_message(__("You already have an user with this e-mail address. We've merged your accounts", 'facebook'));
             // activate user in case is not activated
             $manager->update(array('b_active' => '1'), array('pk_i_id' => $oscUser['pk_i_id']));
             $logged = $uActions->bootstrap_login($oscUser['pk_i_id']);
         } else {
             // Auto-register him
             $this->register_user(self::$user_profile);
         }
         // redirect to log in
         header('Location: ' . osc_base_url());
         exit;
     } catch (FacebookApiException $e) {
         self::$user = null;
     }
     return self::$facebook;
 }
开发者ID:oanav,项目名称:closetshare,代码行数:69,代码来源:OSCFacebook.php

示例15: osc_lib_path

    case 'language':
        // set language
        require_once osc_lib_path() . 'osclass/controller/language.php';
        $do = new CWebLanguage();
        $do->doModel();
        break;
    case 'contact':
        //contact
        require_once osc_lib_path() . 'osclass/controller/contact.php';
        $do = new CWebContact();
        $do->doModel();
        break;
    case 'custom':
        //contact
        require_once osc_lib_path() . 'osclass/controller/custom.php';
        $do = new CWebCustom();
        $do->doModel();
        break;
    default:
        // home and static pages that are mandatory...
        require_once osc_lib_path() . 'osclass/controller/main.php';
        $do = new CWebMain();
        $do->doModel();
        break;
}
if (!defined('__FROM_CRON__')) {
    if (osc_auto_cron()) {
        osc_doRequest(osc_base_url(), array('page' => 'cron'));
    }
}
/* file end: ./index.php */
开发者ID:bomvendador,项目名称:soroka_r,代码行数:31,代码来源:index.php


注:本文中的osc_lib_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。